The Blog of Ian Mercer.

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.

Related Stories

Cover Image for Xamarin Forms Application For Home Automation

Xamarin Forms Application For Home Automation

Building a Xamarin Forms application to control my home automation system

Ian Mercer
Ian Mercer

JSON Patch - a C# implementation

Ian Mercer
Ian Mercer

Dynamically building 'Or' Expressions in LINQ

How to create a LINQ expression that logically ORs together a set of predicates

Ian Mercer
Ian Mercer

VariableWithHistory - making persistence invisible, making history visible

A novel approach to adding history to variables in a programming language

Ian Mercer
Ian Mercer

Updated Release of the Abodit State Machine

A hierarchical state machine for .NET

Ian Mercer
Ian Mercer

Building a better .NET State Machine

A state machine for .NET that I've released on Nuget

Ian Mercer
Ian Mercer
Cover Image for The Internet of Dogs

The Internet of Dogs

Connecting our dog into the home automation

Ian Mercer
Ian Mercer

A simple state machine in C#

State machines are useful in many contexts but especially for home automation

Ian Mercer
Ian Mercer

Convert a property getter to a setter

Ian Mercer
Ian Mercer

MongoDB Map-Reduce - Hints and Tips

Ian Mercer
Ian Mercer
Cover Image for Weather Forecasting for Home Automation

Weather Forecasting for Home Automation

Ian Mercer
Ian Mercer

Lengthening short Urls in C#

Ian Mercer
Ian Mercer

ASP.NET MVC SEO - Solution Part 1

Ian Mercer
Ian Mercer

Building sitemap.xml for SEO ASP.NET MVC

Ian Mercer
Ian Mercer

Tip: getting the index in a foreeach statement

A tip on using LINQ's Select expression with an index

Ian Mercer
Ian Mercer

WCF and the SYSTEM account

Namespace reservations and http.sys, my, oh my!

Ian Mercer
Ian Mercer

404 errors on IIS6 with ASP.NET 4 Beta 2

Ian Mercer
Ian Mercer

Mixed mode assembly errors after upgrade to .NET 4 Beta 2

Fixing this error was fairly simple

Ian Mercer
Ian Mercer

The EntityContainer name could not be determined

How to fix the exception "the entitycontainer" name could not be determined

Ian Mercer
Ian Mercer

Shortened URLs should be treated like a Codec ...

Expanding URLs would help users decide whether or not to click a link

Ian Mercer
Ian Mercer

A great site for developing and testing regular expressions

Just a link to a site I found useful

Ian Mercer
Ian Mercer

Entity Framework in .NET 4

Ian Mercer
Ian Mercer

System.Data.EntitySqlException

Hints for dealing with this exception

Ian Mercer
Ian Mercer

Exception Handling using Exception.Data

My latest article on CodeProject covers the lesser known Exception.Data property

Ian Mercer
Ian Mercer

ASP.NET Custom Validation

How to solve a problem encountered with custom validation in ASP.NET

Ian Mercer
Ian Mercer

Optimization Advice

Some advice on software optimization

Ian Mercer
Ian Mercer

Linq's missing link

LinqKit came in handy back in 2009

Ian Mercer
Ian Mercer

Cache optimized scanning of pairwise combinations of values

Using space-filling curves to optimize caching

Ian Mercer
Ian Mercer

Threading and User Interfaces

A rant about how few software programs get threading right

Ian Mercer
Ian Mercer