How to get CrmSvcUtil.exe to work with Microsoft Dynamics CRM 2011 online
You’d think this would be easy – just download the SDK and run the utility, right? Sadly that’s not the case and the information to make it work is scattered around the web.
Here are the steps I’ve pieced together from various forum answers and some trial and error.
1. Install Microsoft WIF SDK
You can get it here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=eb9c345f-e830-40b8-a5fe-ae7a864c4d76&displaylang=en
Hint: For Windows 7 and Windows Server 2008 R2, select the msu file with name starting Windows6.1. [Naming it Windows7and2008 would have been too easy I guess.]
2. Install Microsoft Dynamics CRM 2011 SDK
You can get it here: http://www.microsoft.com/downloads/en/confirmation.aspx?FamilyID=420f0f05-c226-4194-b7e1-f23ceaa83b69
3. Run the DeviceRegistration.exe utility to generate a device id and password
You can find it in the SDK Tools / DeviceRegistration directory. Run it with command line /Operation:Register
Copy the values for device ID and device password, you’ll need them later
4. Now run CRMSVCUTIL from the MSCRM SDK under the bin directory (not the tools directory)
If you want to copy it to, say, your Utilities directory you’ll need to take all the DLLs with it. [Someone was apparently too lazy to run ILMerge on it.]
The parameters you’ll need are:
crmsvcutil /url:https://<<<Organization>>>.crm4.dynamics.com/XRMServices/2011/Organization.svc /o:crm.cs /n:<<<Desired namespace name>>> /u:<<< your windows live id >>> /p:<<< your windows live password >>> /serviceContextName:<<<Desired service context name>>> /di:<<< Device ID >>> /dp: <<< Device Password >>>
5. That’s it! You should have a file crm.cs that you can use in your Visual Studio Project to interface to MS-CRM.
I just wish it was one step!
6. To add this to your Visual Studio C# Project
Copy the crm.cs file to your solution, add a reference to System.Runtime.Serialization.
Add a /lib folder to your solution and copy the SDK /bin directory into it
Add a reference to the DLLs in there as necessary: Microsoft.XRM.sdk in particular.
Add a reference to System.ServiceModel.
Comments are closed.
about 2 years ago
Hello Ian,
I tried your steps, but still get the same error:
c:\downloads\xrm\SDK\bin>CrmSvcUtil.exe /di:xxxxxxxxxxxxxxxxxxx /dp:”~6+*xbzV90y6esT=rC!xgjRW” /codeCustomization:”Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration” /out:Xrm\Xrm.cs /url:https://edgewatertechnology.crm.dynamics.com/xrmservices/2011/OrganizationData.svc /u:XXXXXXX /p:XXXXXXX /namespace:Xrm /serviceContextName:XrmServiceContext
CrmSvcUtil : CRM Service Utility [Version 5.0.9688.1046]
c 2011 Microsoft Corporation. All rights reserved.
Exiting program with exception: Metadata contains a reference that cannot be resolved: ‘https://login.live.com/login.srf?wa=wsignin1.0&wtrealm=urn:crm:dynamics.com&wctx=rm=1&id=db586b09-9d4b-46b0-a0cc
-e1d27fd8c22e&ru=https%253a%252f%252fedgewatertechnology.crm.dynamics.com%252fxrmservices%252f2011%252fOrganizationData.svc%253fwsdl&wct=2011-04-15T15:39:54Z’.
Enable tracing and view the trace files for more information.
about 2 years ago
I figured it out. Should be ‘Organization.svc’ not OrganizationData.svc.
Thanks for the blog!
about 1 year ago
Thank you! Have been searching on the google for hours now and have found nothing. Still a bit puzzled on the generation of device credentials. But at least now i have a set of proxy classes. Great job, only wish i found your page sooner
about 1 year ago
Good post! Worked with me. Thanks
about 1 year ago
My friend you are my new hero, thank you!