While testing importing of several small managed solutions I was able to create what is known as a circular reference in software engineering. Take it from me this is bad! When referencing assemblies in Visual Studio it prevents you from creating the circular references, however in MSCRM 2011 it doesn’t seem to prevent and if it does I managed to create a situation where it allows you to create the circular reference. So for MSCRM 2011 I am going to dub this as a circular dependency. Once the circular dependency was created I couldn’t delete or update either solution because they were dependant on each other!
So in order to break the dependency I decided to make a few changes to one solution and try and import it. However, I was receiving the following error “This solution cannot be uninstalled because the ‘LocalizedLabel’ with id ‘???(Form)’ is required by the ‘???’ solution. Uninstall the ??? solution and try again.”. I would assume that there are many reasons leading up to you getting this error, so don’t be put off if you have received this error from a slightly different scenario then me. The following solution may still work for you.
I must state at this point that this fix worked for me and I was happy to do it because I knew it would have no effect on either of my solutions as I wanted to update them both! This fix comes with a warning though! You will have to get down and dirty with the MSCRM database and so is unsupported. So if you are thinking about giving it a go make sure you back up your database first, incase you have to roll back.
The problem is that a form element that is required in one solution is being removed by the other. Now as my solutions had move on a lot I couldn’t work out which element it was. So my simple solution was to remove the localizedlabel record directly from the database where there is no dependency checking. Naughty I know… but my environment was controlled. As soon as soon as I removed the record the import worked!
So to remove the record all you need to do is take note of the localizedlabel id and write a delete SQL statement that targets the LocalizedLabel table within MetadataSchema. Make sure you add a where clause for the id you noted down. You don’t want to delete everything! Sample SQL is provided below.
delete from [YOUR DATABASE_MSCRM].[MetadataSchema].[LocalizedLabel] where LocalizedLabelId = 'YOUR ID HERE'
Hope this helps and on your head be it 🙂
delete from [c2cTest1_MSCRM].[MetadataSchema].[LocalizedLabel] where LocalizedLabelId = ‘115fa910-1f48-e111-8b97-101f7433b26c’