The attribute with AttributeId = ‘guid’ was not found in the MetadataCache

I encountered this error when trying to export the solution from Dev environment. There was little information in the exception or the log file, but I could guess that something had been deleted and it didn’t update the MetadataCache (or the solution) somehow.

After googling, I found the solution is to delete the attribute/component from the CRM solution.

private static void RemoveComponentFromSolution(IOrganizationService service, Guid componentId, int componentType, string solutionName)
{
	RemoveSolutionComponentRequest removeRequest = new RemoveSolutionComponentRequest()
	{
		// this is the Guid you have found within your Dynamics 365 trace files
		ComponentId = componentId,
		ComponentType = componentType,
		// This is the unique name, not the display name of the solution you are trying to export
		SolutionUniqueName = solutionName
	};

	var response = service.Execute(removeRequest);
}

The component type can be retrieved using FetchXML

<fetch top="50" &gt;
  <entity name="solutioncomponent" &gt;
    <all-attributes/&gt;
    <filter type="and" &gt;
      <condition attribute="objectid" operator="eq" value="component guid here" /&gt;
    </filter&gt;
  </entity&gt;
</fetch&gt;
Advertisements

Author: Khoa Nguyen

I'm a senior software engineer. I've been focusing on MS Dynamics CRM since CRM 2013. My passion is continuously study and deepen my skills in Microsoft Dynamics CRM and system integrations in order to develop highly scalable, robust and easy to maintain CRM solutions.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s