Could not load file or assembly ‘Microsoft.Xrm.Client

dynamics-crm-2011

I have created a plug-in in CRM. It’s registered successfully. Inside my plug-in I have created a web service with many functions.
After successful calling of plug-in step I am getting error-

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Xrm.Client, Version=5.0.9689.2166, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies`. The system cannot find the file specified.
To solve this issue I have created the New XRM.cs file from crmsvcutil.exe but got the same issue. Searched more about this but no solutions found yet.

NOTE: I am using the Microsoft hosted version of CRM

Here below the reference files which I am using.

  • microsoft.crm.sdk.proxy
  • Microsoft.CSharp
  • microsoft.xrm.client
  • microsoft.xrm.portal
  • microsoft.xrm.sdk
  • System
  • System System.Core
  • System.Data
  • System.Data.Services
  • System.Data.Services.Client
  • System.DirectoryServices.AccountManagement
  • System.Runtime.Serialization
  • System.ServiceModel
  • System.Xml
  • System.Xml.Linq

Is there any way to run my plugin on Hosted version of CRM???

Appreciate if any help 🙂

Best Answer

I have solved this issue by using this command.

CrmSvcUtil.exe /out:"Xrm.cs" 
               /url:http://crm/Contoso/XRMServices/2011/Organization.svc 
               /namespace:Xrm 
               /servicecontextname:XrmServiceContext
               /servicecontextprefix:Xrm

removing code customization options solved my issue.

/codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration"
Related Topic