Today I was working on a Dynamics CRM 4.0 Plug-in we’ve developed in the past and I needed to update the plug-in on our CRM server.
When I loaded the assembly in the Plug-in Registration tool I got the following exception:
Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'Microsoft.Crm.Sdk, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. An attempt was made to load a program with an incorrect format. at System.Reflection.Assembly._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)
Appearently this was due to the fact I was working on a 64 bit environment. When you place the tool in the 64bit folder of the sdk\bin folder, the error doesn’t occur anymore and you’ll be able to succesfully update your plug-in.
No related posts.








3 Comments
I have this exact same issue. I am developing on a 64bit box. But I dont see any folder named "64bit" in sdk\bin. Do I create one?
And did you mean move the PluginRegistration.exe into sdk\bin\64bit directory?
Thanks!
Yes, you need to place the pluginregistration.exe into the 64bit folder. I don’t know why you don’t have a 64 bit folder in there. You can create one, but you will need the 64bit assemblies in there as well. So I guess you need to download the latest version of the sdk.
thanks a lot! i try some solution but none work. I copy the exe into the sdk/bin/x64 directory and i can update my plugins.