Today I had a task to migrate couple of apps that used Microsoft.Xrm.Client assemblies to new Tooling assemblies. In this article I will describe steps to use to migrate your own apps to use latest (and recommended) tools to connect to your CRM Instances from code.
Let’s assume that we have an application that uses Microsoft.Xrm.Client assembly to connect to CRM and it stores connection string to CRM in app.config file as it shown on following screenshots:
Also I assumed that NuGet (and not your local hard drive) was as a source for referenced assemblies. To start migration open “Manage NuGet Pakages…” dialog:
Update (if it is required) SDK assemblies to use latest versions available:
Uninstall Microsoft.CrmSdk.Extension package:
Install latest tooling package:
After all operations list of your NuGet packages should look like following:
Following change should be applied to code – removal of references to namespaces Microsoft.Xrm.Client and Microsoft.Xrm.Client.Services and changing of code for getting of service instance from
var connection = CrmConnection.Parse(
var service = new OrganizationService(connection);
CrmServiceClient service = new
with adding of reference to Microsoft.Xrm.Tooling.Connector namespace.
Don’t forget to change your connection string according to this article.
If your code throws exception like
An unhandled exception of type ‘System.TypeLoadException’ occurred in Microsoft.Xrm.Tooling.Connector.dll Additional information: Could not load type ‘Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior’ from assembly ‘Microsoft.IdentityModel.Clients.ActiveDirectory, Version=184.108.40.2069, Culture=neutral, PublicKeyToken=31bf3856ad364e35’.
open installed NuGet packages and downgrade Microsoft.IndentityModel.Client.ActiveDirectory to 2.28.3 version:
After that your code should work fine: