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:

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:

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:

       /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.

Thu Mar 10 2011 21:39:15 GMT-0800 (Pacific Standard Time)

Next page: Random names in C# using LINQ and a touch of functional programming

Previous page: Extending C# to understand the language of the semantic web