Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Import/Export CDS Entity definition across environments ERROR!

The links above have got me almost all the way of through migrating an entity definiton from one environment to another. So far what I've done is go into Dynamics > Settings > Customizations > Customize the System, then select the entity I want and then export. It's hanging for a solid 5 minutes before throwing the error below.

  <ErrorDetails xmlns:d2p1="">
      <d2p1:value xmlns:d4p1="" i:type="d4p1:string">Plugin/Microsoft.Crm.WebServices.ExportXmlService</d2p1:value>
      <d2p1:value xmlns:d4p1="" i:type="d4p1:string">Microsoft.Crm.CrmException: An unexpected error occurred. ---> System.InvalidOperationException: The specified node cannot be inserted as the valid child of this node, because the specified node is the wrong type.
   at System.Xml.XmlNode.AppendChild(XmlNode newChild)
   at System.Xml.XmlNode.AppendChild(XmlNode newChild)
   at Microsoft.Crm.Tools.ImportExportPublish.SiteMapExportHandler.AppendAppModuleSiteMapXml(XmlDocument exportDocument, Guid siteMapId, String siteMapElementInnerXml)
   at Microsoft.Crm.Tools.ImportExportPublish.SiteMapExportHandler.AppendXml(XmlDocument exportDocument, Guid siteMapId, String siteMapElementInnerXml)
   at Microsoft.Crm.Tools.ImportExportPublish.SiteMapExportHandler.ExportItem(XmlDocument exportDocument, Guid siteMapId)
   at Microsoft.Crm.Tools.ImportExportPublish.AppModuleSiteMapHandler.ExportItem(XmlDocument exportDocument)
   at Microsoft.Crm.Tools.ImportExportPublish.ExportHandler.Export(XmlDocument XDoc)
   at Microsoft.Crm.Tools.ImportExportPublish.RootExportHandler.RunExport()
   at Microsoft.Crm.WebServices.ExportXmlService.ExportSolutionWithTargetVersion(String solutionName, Boolean managed, String targetVersion, Boolean exportAutoNumberingSettings, Boolean exportCalendarSettings, Boolean exportCustomizationSettings, Boolean exportEmailTrackingSettings, Boolean exportGeneralSettings, Boolean exportMarketingSettings, Boolean exportOutlookSynchronizationSettings, Boolean exportRelationshipRoles, Boolean exportIsvConfig, Boolean exportSales, Boolean exportExternalApplications, ExecutionContext context)
   --- End of inner exception stack trace ---
Solution Supplier
Solution Supplier

Based on the stack trace, this looks like the problem is a corrupt SiteMap (navigation structure). If your entity is included in any Areas (e.g. Sales, Settings), then the SiteMap will be included in the export.

There are a couple of different ways to resolve this:

  1. You could use the XrmToolbox tools, which have an option to reset the SiteMap. This would reset the whole SiteMap, so may not be viable if you have a lot of SiteMap customisations and no backup of them
  2. You could remove the entity from all Areas (the 'Areas that display this entity') check boxes on the entity properties (in the customer experience user interface). Save and publish the entity, then export

Helpful resources


Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users


We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Users online (16,869)