Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plugin with references not working on CRM 2011

I have created a plugin and used a reference to another project (DLL) I have created. The problem is when I try to run the plugin, I get a CRM error saying:

Could not load file or assembly 'XXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a760feb9ec7271a9' or one of its dependencies. The system cannot find the file specified.

Does anyone have any idea on solving this one?

like image 745
DorR Avatar asked Jul 12 '11 10:07

DorR


3 Answers

You have to deploy the referenced assembly either to the GAC or merge it with your one (with ILMerge)

See also http://msdn.microsoft.com/en-us/library/gg309620.aspx and Creating a single CRM plugin DLL to store in the CRM database

like image 123
ccellar Avatar answered Oct 26 '22 08:10

ccellar


I have a blog post here on how you can put it all in 1 DLL without ILMerge: All References within CRM2011 plugin. We've yet to have a dll issue since we started doing this.

NB this approach rules out the use of Sandboxed mode (i.e., you will not be able to use this approach should you require your plugin to work in Dynamics CRM Online).

like image 22
ryanjones Avatar answered Oct 26 '22 09:10

ryanjones


We have had this error several times over the last 6 months and each time, despite me or the other developers swearing blind it would not be the case, it has turned out to be a DLL version problem.

Are you installing the plugin to disk, DB or GAC?

If installing to the GAC, I believe external DLLs go in the GAC as well. If installing to the DB or to disk, I believe DLLs go in the \assembly\bin folder.

like image 21
glosrob Avatar answered Oct 26 '22 10:10

glosrob