Cannot import managed solution after upgrading from Dynamics CRM 4.0 to CRM 2011

After upgrading from Dynamics CRM 4.0 to CRM 2011, some users experience the issue when they developed the managed solution from development organization and want to import it to production environment.

When imported, everything seems to be working fine as the progress bar goes until the end. But eventually the import fails and user gets the error message from Dependency Calculation Item saying a message like:

"Found 9 dependency records where unmanaged component is the parent of a managed component. First record (dependentcomponentobjectid = efa9ff93-2e9e-e011-9155-000c293b421c, type = AttributeMap, requiredcomponentobjectid = a12a0085-d57e-413d-9f68-5509c790152c, type= EntityMap, solution = 01759d58-5802-4c43-9ee3-bdd3a5db5b41).”

If you try creating another managed solution containing only a certain Entity, the same behaviour happens and the error message from  Dependency Calculation Item becomes:

"Found 6 dependency records where unmanaged component is the parent of a managed component. First record (dependentcomponentobjectid = 37aec869-bdd6-4e9d-aabd-593ad1fe171c, type = Attribute, requiredcomponentobjectid = b11677ff-395c-df11-afc3-000c293b421c, type= Entity, solution = d32dd13c-90e8-4d94-acac-22bf1974161c)."

However, the problem does not occur when importing Unmanaged solution.

CAUSE:

This error happens because there is a custom mapping from an entity outside a managed solution to an entity inside a managed solution, which is not allowed.

As the user has upgraded the solution from CRM 4.0 to CRM 2011, the entities do already exist and are considered as unmanaged solution outside managed solution. Therefore when importing the managed solution, customer will get such error message.

RESOLUTION:

Delete the existing AttributeMap from the customation.xml file as well as the CRM system. Then refill the Database by importing the new Managed solution. This can be done by:

1. Back up CRM database, just in case things go wrong.

2. Unzip the solution and modify customization.xml, search for <AttributeMaps> and replace that tag with <AttributeMaps />

Copy all the related attribute mapping definitions (like an example in the red circle) and paste it to notepad, you will need these information later.

Then delete these mapping definitions from the xml file and also delete </AttributeMaps>

Repeat this action for all <AttributeMaps> you find under the EntityMap ( from the example error above there will be 9 places in the file – matches to the error message “Found 9 dependency records where unmanaged component is the parent of a managed component”)

clip_image002

After modification zip it back as new solution - Now you have both original solution and new solution as we will need the original one later.

3. Remove the corresponding attribute mappings from the DB. By going to your orgName_DB, Search for the records in AttributeMapBase table that has the SourceAttributeName and TargetAttributeName matches to   the mapping definitions you have in Notepad. Then delete these records from DB.

4. Import the new solution as managed. Publish all customization

5. Import the original file with the attribute mappings included

 

Best Regards

Dynamics CRM Team