
Hi,
I'm having problem registering my plugin (.NET4, CRM2011 plugin) I'm getting the following error.
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'COMPANYNAME.XrmFrameWork.Base, Version=1.0.0.0, Culture=neutral, PublicKeyToken=45c1c3ad35f52145' or one of its dependencies. The system cannot find the file specified.
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at PluginRegistrationTool.AssemblyReader.RetrievePluginsFromAssembly(String path)
at PluginRegistrationTool.AssemblyReader.RetrievePluginsFromAssembly(String path)
at PluginRegistrationTool.RegistrationHelper.RetrievePluginsFromAssembly(String pathToAssembly)
at PluginRegistrationTool.PluginRegistrationForm.btnLoadAssembly_Click(Object sender, EventArgs e)
when trying to register the plugin, I gotten so far in my debugging to see that it has something to do with inheritance.
My code is as follows :
We have on dll (COMPANYNAME.XrmFrameWork.Base) containing a BasePluginAction (extends IPlugin) which implements the Exectute(IServiceProvider)-method. It does some prechecks and postchecks and also some logging on errors.
In my solution I have 3 dlls, (Base,Business, Plugins). In the Base I have a solution specific class PluginBaseSolution where I add initialization of the loggers etc in the way this solution does it.
All Plugins in the Plugins.dll inherits from this, idea here is that if there will be customer specific plugins made they will be their own .dll but will inherit from the same PluginBaseSolution as the "base" does.
Here we come back to my problem, if loading the solution specific Base.dll I can see the listed baseclass as a plugin. But when loading the Plugin.dll it complains about the COMPANYNAME.XrmFrameWork.Base.dll.
All dlls have been added to the GAC and all dlls also exists the same directory as the Plugin.dll.
If I move the Baseclass to the Plugin.dll I can load the assembly. I still cannot import it I get the error :
"Plug-in assembly does not contain the required types or assembly content cannot be updated."
But has anyone done anything similar in crm2011 and gotten it to work? In CRM4 this worked OK.
*This post is locked for comments
I have the same question (0)Hi I got around the problem with required types by adding the dlls to the CRMWeb\bin-directory. It seems like it is not using GAC as I thought it would