Development, Dynamics CRM

Plugin error with cryptic error message

Plugins are a common way to add functionality, especially in an on premise system, as there is missing the possibility for using the flows.

I created such a plugin, which uses some of the localization methods, deployed the plugin to my development system and got the following error.

At the first look, I was not able to get any information out of the message. I googled the message, but also, there were no useful hits.

After some checking’s I found the solution in my Visual Studio. In my solution I added the CRM nuget packages, which are added to the references of the project. One of the CRM-references was set to “copy local” true. This means, that this dll file will also be copied to the output folder.

Set "Copy Local" to false in crm plugin development
Set “Copy Local” to false in crm plugin development

Combined with my current ilmerge configuration, which combines all build library-files to one (as I have some helper classes in separate projects), this lead to the problem, that the crm-dlls were also merged in to my plugin.dll.

Deployed to the CRM System, the plugin contains the dll with the same namespace as crm has already through the default installation. This leads to the suspicious error message.