locked
CRM 2011 - the type initializer for 'Microsoft.Xrm.Client.CodeGeneration.CodeCustomization' threw an exception RRS feed

  • Question

  • Hi,

    Im tried the 2011 sdk Walkthrough: Build a Console Application  http://msdn.microsoft.com/en-us/library/gg695803.aspx
    But I received an error by generating the Early Bound Types! Perhaps anybody has an idea.
     
    I have copied the "Microsoft.Xrm.Client.CodeGeneration.dll" file from the "sdk\bin" folder in the "c:\Program files\Microsoft Dynamics CRM\Tools\" directory where the CrmSvcUtil.exe is also stored.
     
    When I execude the command :
     
    "c:\Program files\Microsoft Dynamics CRM\Tools\CrmSvcUtil.exe" /out:EntityGeneratedCode.cs /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" /url:http://localdev:5555/DevService/XRMServices/2011/Organization.svc /domain:DEVELOPMENT /username:administrator /password:xxx /namespace:InfomanAG.Entities /servicecontextname:InfomanAGServiceContext
     
    I received the follwoing error:
     
    the type initializer for 'Microsoft.Xrm.Client.CodeGeneration.CodeCustomization' threw an exception.
    Enable tracing an view the trace file for more information.
     
    If I enabled tracing, there isn't any tracelogitem with status error?! What's the matter?
     
    If I generate Early Bound Types whitout the /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" parameter it works fine. Im using CRM 2011 with UR1. Thanks for any hints
     
    regards 
    Matthias

    Wednesday, April 27, 2011 6:02 PM

Answers

  • You are hitting the error because the build version of the crmsvcutil dll is different in the new SDK than the one provided  by default in the CRM Tools directory- I can reproduce the error when I run that dll from the TOOLS dir rather than the SDK\bin DIR-
     The tools dir from the CRM install has a 5.0.9688.1045 and the SDK\bin dir has a 5.0.9688.1046- you can verify this from the DLL details.
    Please run your commands from the SDK\bin location and the CS file will generate without issues.

    PS- This is will be fixed in the next SDK update (first week of June)


    Thanks,
     
    Ishita


    Best regards,

    Ishita Kunwar
    Partner Online Technical Community
    -----------------------------------------------------------------------------------------
    We hope you get value from our new forums platform! Tell us what you think:
    http://social.microsoft.com/Forums/en-US/partnerfdbk/threads
    ------------------------------------------------------------------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Edited by Ishita Kunwar Tuesday, May 10, 2011 3:52 PM change
    • Proposed as answer by Mistafreeze Thursday, May 12, 2011 6:17 PM
    • Marked as answer by Matthias Back Saturday, May 14, 2011 12:22 PM
    Monday, May 9, 2011 9:44 PM
  • There is no need to copy the CrmSvcUtil to any other folder.  You should use it in the SDK folder that it is located in.  There is no use of the utility in the CRM Server.  Developer workstations are also not on the server.  The standard practice that you should consider is to install the CRM SDK on your developer workstation, and use the latest CrmSvcUtil program from the CRM SDK folder that you have installed locally, not on the CRM Server.  You cannot mix-and-match the code-generation assembly with older versions of the CrmSvcUtil - you should use the pair that are matched in the SDK.
    Shan McArthur www.shanmcarthur.net Check out the commercial edition of xRM portals @ www.adxstudio.com
    • Proposed as answer by Mistafreeze Thursday, May 12, 2011 6:17 PM
    • Marked as answer by Matthias Back Saturday, May 14, 2011 12:22 PM
    Tuesday, May 10, 2011 3:57 PM
    Moderator

All replies

  •  

    Has nobody yet use the Early Bound Type Generation based on sdk 5.0.3 ?

    Monday, May 2, 2011 8:52 AM
  • I have the same issue
    Tuesday, May 3, 2011 4:46 PM
  • You are hitting the error because the build version of the crmsvcutil dll is different in the new SDK than the one provided  by default in the CRM Tools directory- I can reproduce the error when I run that dll from the TOOLS dir rather than the SDK\bin DIR-
     The tools dir from the CRM install has a 5.0.9688.1045 and the SDK\bin dir has a 5.0.9688.1046- you can verify this from the DLL details.
    Please run your commands from the SDK\bin location and the CS file will generate without issues.

    PS- This is will be fixed in the next SDK update (first week of June)


    Thanks,
     
    Ishita


    Best regards,

    Ishita Kunwar
    Partner Online Technical Community
    -----------------------------------------------------------------------------------------
    We hope you get value from our new forums platform! Tell us what you think:
    http://social.microsoft.com/Forums/en-US/partnerfdbk/threads
    ------------------------------------------------------------------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.

    • Edited by Ishita Kunwar Tuesday, May 10, 2011 3:52 PM change
    • Proposed as answer by Mistafreeze Thursday, May 12, 2011 6:17 PM
    • Marked as answer by Matthias Back Saturday, May 14, 2011 12:22 PM
    Monday, May 9, 2011 9:44 PM
  • There is no need to copy the CrmSvcUtil to any other folder.  You should use it in the SDK folder that it is located in.  There is no use of the utility in the CRM Server.  Developer workstations are also not on the server.  The standard practice that you should consider is to install the CRM SDK on your developer workstation, and use the latest CrmSvcUtil program from the CRM SDK folder that you have installed locally, not on the CRM Server.  You cannot mix-and-match the code-generation assembly with older versions of the CrmSvcUtil - you should use the pair that are matched in the SDK.
    Shan McArthur www.shanmcarthur.net Check out the commercial edition of xRM portals @ www.adxstudio.com
    • Proposed as answer by Mistafreeze Thursday, May 12, 2011 6:17 PM
    • Marked as answer by Matthias Back Saturday, May 14, 2011 12:22 PM
    Tuesday, May 10, 2011 3:57 PM
    Moderator
  • thanks for the solution!

    regards

    matthias

     

     

    Saturday, May 14, 2011 12:24 PM
  • Hi I already got the August version of SDK, but I am still got this error message when I run CrmSvcUtil with "/codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration", any ideas?

    Thanks.

    Thursday, August 30, 2012 4:55 AM
  • I just downloaded the SDK with a newly installed (updated)  version of 2011 and am getting the same error when running from the SDK\bin directory. I
    Monday, November 26, 2012 1:49 AM