I've downloaded CRM Dynamics SDK and keep it in a local directory. In my code, I'm using EntityCollection
(amongst other classes related to Xrm namespace), which means that I need to add using Microsoft.Xrm.Sdk;
.
The problem is that during compilation I get errors saying that:
The type or namespace name 'Xrm' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
So, I double check that the reference is made and, very accurately, I see that microsoft.xrm.sdk
indeed is in my list. Just to be sure, I've removed it and added it again by pointing to the DLL with the same name. To no avail, though... The flabbergasting thing is that my colleague uses the same code and it compiles on his machine (the only difference being that he's on Win 7 and I'm on Win 8).
How do we kill this problem?
I had this error and in my case, after trying all the above solutions and others on the web with no success, finally I came to a solution.
The problem was in the version of CRM SDK that I was using: 2015 (don´t wanna know why!).
Downloaded CRM 2013 SDK version, changed the assembly references to that version and the problem was gone.
Reason for it is CRM 2015 SDK was built on .Net 4.5.2 Framework and the Visual studio does not support 4.5.2.
Just download .Net Framework 4.5.2 Goto Project Properties and change the framework.
After changing to .NET Framework 4 and changing .NET Framework into 3.5 and then back to 4.0, my poject was still not working.
It didn't work when I selected the option given by the "add Reference" window.
What worked for me was to click on the browse button in the "add Reference" window and look for the Microsoft.Xrm.Sdk.dll file
Updating NuGet Package helped me to solve the problem
I received this when replacing my crm 2013 dlls with the new 2015 ones.
None of the above solutions worked for me. But what eventually led me on the right track was this warning (it was listed as a warning below the namespace errors):
And when I checked I only had .Net 4.5.1 installed so after installing .Net 4.5.2 Developper pack and switching the target framework of my projects to this everything worked again.
The regular 4.5.2 update is not enough to get this version of .net in VS, you need the developper pack
Source: http://www.syntaxwarriors.com/2015/using-crm-2015-sdk-gives-error-that-xrm-does-not-exist-in-the-namespace/
This may not match this specific problem, but I'll add this as something to check for others in case Google directs them here like it did for me.
In my case, I was getting a lot of errors like, "error CS0234: The type or namespace name 'Client' does not exist in the namespace 'Microsoft.Xrm'".
Adding the "Microsoft.CrmSdk.Extensions" NuGet package fixed my compilation issues.