locked
CRMSDK - Plugin registration 2.1 RRS feed

  • Question

  •  

    I am trying to get a plugin registered on my CRM 4.0 server.  the Server is 32 bit.  My development system is 64 bit.   I am guessing this might be were my problem is, but not sure how to determine if this is the cause and if so how to solve.   My plugin assemply builds without error.  the Register Plugin tool version 2.1 builds correctly and was added to external tools and runs.   If I select the Microsoft.CRM.SDK assembly it will add it to the list of assembly I can choose to register (I don't intent to register the sdk, but use it as a test).  If I select any of the several sample plugin assemblys that I have built using the walkthrough on the sdk, I get the message:

    "Unable to load the specified Plugin Assembly   Would you like to see the details for this error?"  If I select "yes", I get:

     

    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 PluginRegistrationTool.AssemblyReader.RetrievePluginsFromAssembly(String path) in C:\Users\Public\Downloads\PluginRegistration_2.1\PluginRegistration 2.1\AssemblyReader.cs:line 59
       at PluginRegistrationTool.AssemblyReader.RetrievePluginsFromAssembly(String path)
       at PluginRegistrationTool.RegistrationHelper.RetrievePluginsFromAssembly(String pathToAssembly) in C:\Users\Public\Downloads\PluginRegistration_2.1\PluginRegistration 2.1\RegistrationHelper.cs:line 49
       at PluginRegistrationTool.PluginRegistrationForm.btnLoadAssembly_Click(Object sender, EventArgs e) in C:\Users\Public\Downloads\PluginRegistration_2.1\PluginRegistration 2.1\PluginRegistrationForm.cs:line 127

     

    Per the one result of my google search for this issue I found a post that said to add the microsoft.crm.sdk and the microsoft.crm.sdktypeproxy in the bin\debug folder along with the plugin assembly - but this did not resolve my issue (out of desperation I tried the 32 bit and the 64 bit assemblies with the same poor results).

    Thursday, October 9, 2008 12:22 AM

Answers

  • I realize that this post is a year old, but it seems to be the only reasonable search result on the issue on most search engines, so I just wanted to add that I had the exact same issue (aka my server is x86 but development box is x64), and I was able to resolve the issue by setting the target CPU from "Any CPU" to "x86" in the Visual Studio Project. My x64 bit machine automatically handles x86 like it does with all other x86 type applications (using WOW).

    Thanks,
    Pete
    Wednesday, December 2, 2009 11:33 PM

All replies

  • Fred;

     

    Let us deal with the Plugin Registration tool issue first. If you follow the instructions in the readme.doc file that is in the tool's source code folder, you will be adding Web References to the CRM Web services. If you do that, you should not get the File Not Found error. If you are using Visual Studio 2008, make sure that you add Web References and not Service References.

     

    If instead you add References to the Microsoft.Crm.Sdk* assemblies, you need to make sure that those assemblies exist in same folder where the tool's executable is located before running the tool. Since you are probably building a 64bit version of the tool, make sure that you reference the 64bit versions of those assemblies in the SDK\bin\64bit folder.

     

    Now on to the next issue. Since your CRM server is 32bit, you will need to compile 32bit plug-in assemblies. This can be done by setting the platform target to x86 in the Build tab of the plug-in project's properties.

     

     

    PeteH

     

    Thursday, October 9, 2008 2:36 AM
  • First, thank you for responding.

     

    Yes, before building the tool, I added the web reference to my crm webservice per the readme.doc.   built the tool and added it to my external tools in VS 2005 (I am currently using 2005, but thanks for the note regarding 2008 as I could develop in VS 2008 instead).   the web reference urls for CrmSdk, CrmSdk.Discovery and MetadataServiceSdk are http://crm.mydomain.com/...  I can update the web references without error.

     

    I just changed my platform target for my plugin project to x86 from any CPU - thank you for pointing that out to me.

     

    Ok, I just tried again verifying that the plugin which does use the CRM.Sdk assemply does reference the 32 bit assembly and that it was built for the x86 platform and that I have the same crmsdk  assemblies in the same folder as the registration tool exe.  the plugin builds without error (the CRMSDK AccountCreate walkthrough) but when I try to load the assembly I get the same error.

     

    I am sure I am missing something - but I don't know what.

     

    Thursday, October 9, 2008 8:12 PM
  • I realize that this post is a year old, but it seems to be the only reasonable search result on the issue on most search engines, so I just wanted to add that I had the exact same issue (aka my server is x86 but development box is x64), and I was able to resolve the issue by setting the target CPU from "Any CPU" to "x86" in the Visual Studio Project. My x64 bit machine automatically handles x86 like it does with all other x86 type applications (using WOW).

    Thanks,
    Pete
    Wednesday, December 2, 2009 11:33 PM
  • Any clue how to solve 64bit server, 32bit development machine?
    Welcome to help me with my open source project at http://code.google.com/p/batch-image-watermark-processor/
    Tuesday, February 9, 2010 7:45 PM
  • Use the assemblies in the bin/64bit folder of the sdk (which are compiled as 'Any CPU') and compile your project with 'Any CPU'.
    Tuesday, February 9, 2010 8:03 PM
  • Any clue how to solve 64bit server, 32bit development machine?
    Welcome to help me with my open source project at http://code.google.com/p/batch-image-watermark-processor/

    By default 64 bit machines automatically handle 32 bit assemblies, so you should be ok using 32 bit assemblies on both your development machine and the server. Are you getting any sort of error?

    Pete
    Tuesday, February 9, 2010 9:37 PM
  • Hi Pete,

    on a 64bit-OS Dynamics CRM will be installed as 64bit implementation. Therefore all CRM related processes are 64bit ones. 
    You cannot load 32bit libraries in an 64bit process space, or the other way round.

    Please read the blog article which I have referenced above which explains the details. You simply have to use the "64bit" assemblies and compile your project as 'Any CPU'. Thats all and you don't have to worry anymore if your target system is a 32bit or 64bit one.
    Tuesday, February 9, 2010 10:33 PM