pluginsdynamics-crmdynamics-crm-2016

CRM could not load file or assembly to my project


I added a reference itextsharp.dll to my plugins project, when running my plugins using plugin-registration tool I get this exception:

Could not load file or assembly or one of its dependencies. The system cannot find the file specified

I tried removing the ref and adding it again, cleaning and then adding it to my project from different places. Is there restrictions in plugin registration tool about adding non crm dlls? why ? how to solve it?


Solution

  • This is not going to work - you cannot reference external assemblies from CRM plugins that are registered in database. If you want to do this, you will have to merge your external dll with your plugin assembly. You have to remember that adding assembly as reference is not automatically making your referenced assembly available for your base assembly, therefore if you register your plugin assembly in CRM, system is not going to "magically" find somewhere your external assembly (in your case - "itextsharp.dll"). If this is not Online system, you can add your assembly to GAC, or register all your assemblies on Disk instead of database (not recommended approach). If you want to register them in database, you will have to merge everything in one assembly using ILMerge for example.