CRM 4 – Plugin registration problems – Could not load file or assembly

I tried registering a plugin in CRM 4 and it was hard work.

Firstly I had to build the Plugin Registration Tool, WHY???

I then initially tried to register my plugin, only to find I had not implemented the plugin interface.  I tried to compile the simple walkthrough in the SDK which had compile errors in!!

I signed my plugin (although it was pfx and snk)

but then when I tried to registered the plugin I got this error

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.Crm.Sdk, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
at System.Reflection.Assembly._GetExportedTypes()
at System.Reflection.Assembly.GetExportedTypes()
at PluginRegistrationTool.AssemblyReader.RetrievePluginsFromAssembly(String path) in C:\<path>\PluginRegistrationV2\PluginRegistration\AssemblyReader.cs:line 59
at PluginRegistrationTool.AssemblyReader.RetrievePluginsFromAssembly(String path)
at PluginRegistrationTool.RegistrationHelper.RetrievePluginsFromAssembly(String pathToAssembly) in C:\<path>\PluginRegistrationV2\PluginRegistration\RegistrationHelper.cs:line 49
at PluginRegistrationTool.PluginRegistrationForm.btnLoadAssembly_Click(Object sender, EventArgs e) in C:\<path>\PluginRegistrationV2\PluginRegistration\PluginRegistrationForm.cs:line 127

This forum post was very helpful the problem was the microsoft.crm.sdk.dll has to be in the same directory as the Plugin Registration tool.

I put this in the same folder but I was still having problems.

The reason for this was because I had copied in the 32 bit microsoft.crm.sdk.dll and instead I swapped this with the 64 bit microsoft.crm.sdk.dll and then it worked.

I don’t know why Microsoft make this so difficult because there is nothing worse than having to go through these problems when you are just setting up a system.

There must be some reason they don’t add the plugin registration tool as an Exe but I have never figured it out.

4 thoughts on “CRM 4 – Plugin registration problems – Could not load file or assembly

  1. Bharat Sahani January 9, 2012 / 10:43 am

    It helped !
    Strange Microsoft .. but thanks for this post ! 🙂

    Like

  2. Paul March 7, 2012 / 9:48 pm

    “This forum post was very helpful the problem was the microsoft.crm.sdk.dll has to be in the same directory as the Plugin Registration tool.”

    Thanks, it was just what I needed.

    Like

  3. Mo March 15, 2012 / 3:15 pm

    Thanks for sharing! Saved me a bunch of time.

    Like

  4. iceCold June 13, 2013 / 4:54 pm

    Thank you very much for the post. Had gone through the first few issues myself, then stumbled upon your post , saved me a lot of time and frustration.

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.