Find missing dependencies when deleting a solution

When deleting a solution in Dynamics CRM, the system checks for dependencies first. If any of the dependencies still exist, then the delete operation will be aborted and the user will receive an error message:

Connot Delete Component (Cannot delete Main because one or more components require it."

The only option for more info, is the Download Log File, but this doesn't tell you really what happened either:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: The Main() component cannot be deleted because it is referenced by 1 other components. For a list of referenced components, use the RetrieveDependenciesForDeleteRequest.Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorCode>-2147160033</ErrorCode> <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<KeyValuePairOfstringanyType><d2p1:key>0</d2p1:key><d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">Main</d2p1:value></KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType><d2p1:key>1</d2p1:key><d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string"></d2p1:value></KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType><d2p1:key>2</d2p1:key><d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">1</d2p1:value></KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType><d2p1:key>3</d2p1:key><d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">Solution</d2p1:value></KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>4</d2p1:key>
<d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string"><a id='a_helplink' tabindex='0' class='ms-crm-Dialog-Error-Link' onclick='openStdWin("\x2ftools\x2fdependency\x2fdependencyviewdialog.aspx\x3fobjectid\x3d\x257b703af1df-aafb-4c61-b97f-da639fbe8d27\x257d\x26objecttype\x3d7100\x26operationtype\x3ddependenciesforuninstall", null, 800, 600, null)'>Details</a></d2p1:value>
</KeyValuePairOfstringanyType>
</ErrorDetails>
<Message>The Main() component cannot be deleted because it is referenced by 1 other components. For a list of referenced components, use the RetrieveDependenciesForDeleteRequest.</Message>
<Timestamp>2015-02-12T12:24:36.2628436Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>

However, there seems to be a little bit of useful info in there. This is the section "\x2ftools\x2fdependency\x2fdependencyviewdialog.aspx\x3fobjectid\x3d\x257b703af1df-aafb-4c61-b97f-da639fbe8d27\x257d\x26objecttype\x3d7100\x26operationtype\x3ddependenciesforuninstall". When replacing some chracters ("\x2f" to "/", "\x3" to "?", "\x3d" to "=", "\x26" to "&", "\x257b" to "{" and "\x257d" to "}"), then you're presented with the url: /tools/dependency/dependencyviewdialog.aspx?objectid={703af1df-aafb-4c61-b97f-da639fbe8d27}&objecttype=7100&operationtype=dependenciesforuninstall. Add "http://[yourserver] to the beginning and you've got your url that'll tell you exactly what dependencies to remove before you can remove the (managed) solution.

A shorter approach, but just as effective would be to take this url and change yourserver and the solution guid:

http://yourserver/tools/dependency/dependencyviewdialog.aspx?objectid={solutionguid}&objecttype=7100&operationtype=dependenciesforuninstall

Your solution guid can be found by opening the solution and pressing F11 or CTRL+N to see the url. In the url take the section between %7b and %7d: https://[yourserver]/tools/solution/edit.aspx?id=%7bC418E1D5-9AFB-E311-90E1-00155D042F50%7d) and you're set to go!

5 comments:

crm said...

When someone writes an article he/she maintains the plan of a user in his/her brain that how a user can be aware of 
it. So that's why this piece of writing is perfect. Thanks!

Anonymous said...

Nice article.
Thanks for this instruction.
I couldn't delete a solution and my CRM 2015 won't tell me, what dependencies there were.
With your help, the solution is gone. ;)

Brian Qing said...

Thanks for the post. It saves me a lot of time. Now the problem is, after having found the dependencies, how would I remove them?

Here is an example:
Display Name Name/Id Type Managed Solution Required by
Application Ribbons RibbonCustomization Application Ribbons Universal Search Account

I could NOT remove the dependency Application Ribbons from Account. BTW, Application Ribbons is not showing in my Client Extension.

Tomas Schulkes said...

Good article :) 1 correction:

"\x3" to "?" should be "\x3f" to "?"

Local Packers And Movers Bangalore said...

I am really enjoying reading your well written articles. I think you spend numerous effort and time updating your blog.
Local Packers And Movers Bangalore