Monday, March 16, 2009

Plugin Registration Tool FileNotFoundException

If you run into this error when attempting to register a plug-in...

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'PluginRegistration, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)

... you might read elsewhere that you need to copy microsoft.crm.sdk.dll and microsoft.crm.sdktypeproxy.dll to the same folder as the Plugin Registration Tool's executable. Although that might work for you, it didn't work for me today. I'm working on a VPC with a customer's instance of CRM 4.0 restored onto it and attempting to register a plug-in led to the unhandled exception. (I tried version 2.1 and 2.2 of the registration tool.)

The "fix" was to load the PluginRegistrationTool.sln solution (Visual Studio 2005) and recompile. The application then allowed me to register the plug-in. It apparently found itself!? :-)

-Tim

5 comments:

  1. I suspect you will find by "recompiling" you probably ended up with extra references in the root where the app sits. I think one of those references is the file not found exception that you see.

    ReplyDelete
  2. Renaming the exe to PluginRegistration.exe fixes the problem. It is orignially CRMPluginRegistration.exe which is incorrect. It has to do with the wrong name of the exe in the code.

    ReplyDelete
  3. Renamed the plugintool to PluginRegistration.exe and added the DLL's to the same folder solved the issue for me.
    No recompile necessary

    ReplyDelete
  4. The problem actually "PublicKeyToken=null"

    I had the same problem yesterday and I had to force-sign my assembly before I could register it.

    If you go back and check that assembly within the plugin registration tool, you will see in the properties along the right side that PublicKeyToken now has a value :)

    ReplyDelete
  5. BIG TNX for this post :) I was searching for this problem for hours... and actually what helped me was "... you might read elsewhere that you need to copy microsoft.crm.sdk.dll and microsoft.crm.sdktypeproxy.dll to the same folder as the Plugin Registration Tool's executable"

    http://ekoncis.blogspot.com

    ReplyDelete