Freigeben über


How to fix building a strong type lib for CRM 7.1 (CRM 2015 Online Update 1) Errors

If your using an older version of the CrmSvcUtil.exe to generate a strongly typed lib for your projects,  you may have noticed that it seems to have stopped working against CRM Online with the 7.1 update ( carina or CRM 2015 Online Update .1 ).  Your probably seeing an error or errors that looks like this: 

Failed to generate code for the service reference with 'https://schemas.microsoft.com/xrm/7.1/Metadata:ArrayOfEntityKeyMetadata' is not declared

If you happen to use Visual Studio to generate proxies via the Add Service process from the CRM endpoint, you may have seen it too.

Ok Great,  so you see the error, What the heck does that mean?!..

So long story short… We have been adding a lot of new objects to the API over the last several releases and have run into an interesting issue when dealing with WCF generated proxy’s.  We fixed it by adding version logic into the WSDL request for our connectors, that way they build the correct in memory proxy for the right version of SDK connected clients.  That works quite well for things that use our SDK assemblies,  but not so well for folks that are not using them, or are using some older versions of our tools.

How to fix it.

For a while now we have supported a header in the CRM WCF API to identify the version of the SDK that is talking to it,  this allows us to down-level the API to support older versions of the SDK assemblies,  his header key is called sdkversion.

You can also use sdkversion as a url param when creating proxy’s for custom components or, as in the case with the CrmSvcUtil, older versions of some of our tools.

For example, 

If you are talking to a 7.1 deployment, and you want CRM to report the WSDL Info for a 7.1 compliant connection and generate a strong typed class, you would address the service as such via the CrmSvcUtil:

CrmSvcUtil.exe /url:”**https://YOURORG.api.crm.dynamics.com/XRMServices/2011/Organization.svc?singleWSDL\&sdkversion=7.1**” /o:test.cs /n:test /u:ACCT@YOURORG.onmicrosoft.com /p:XXXXXXX

Notice that we added the ?singleWSDL&sdkversion=7.1 to the Url,  this tells CRM that you are asking for the 7.1 version of the WSDL..  that then allows the command to complete,  the right metadata to come down, and you to have a class created as ( in this case ) test.cs that has all your strongly typed objects in it.

We will be updating the doc’s for the CrmSvcUtil soon to reflect this,  ( you can find those here )

Happy Crm’ing

Comments

  • Anonymous
    July 13, 2015
    The comment has been removed
  • Anonymous
    August 24, 2015
    My Log ->  8/25/2015 10:03:52 AM : Metadata contains a reference that cannot be resolved: '192.168.0.196/.../Organization.svc.