I received this error after switching from the CRM 2013 SDK dlls to the new CRM 2015 SDK .Dll’s.
The type or namespace name ‘Xrm’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?)
Which led me to this StackOverflow question; “Can’t access Microsoft.Xrm namespace” which seems very similar but does not solve my problem.
What eventually led me to a solution was a warning listed further down in the list of errors. It seems that Microsoft with the new SDK has switched to .Net 4.5.2 so the whole problem for me was that I needed to install a later version of .Net (minimum 4.5.2) and then switch target frameworks to this.
This is the warning that led me to this solution:
The primary reference “Microsoft.Xrm.Client, Version=5.0.9689.2166, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL” could not be resolved because it was built against the “.NETFramework,Version=v4.5.2″ framework. This is a higher version than the currently targeted framework “.NETFramework,Version=v4.5.1″.
So the solution turned out to be as simple as getting the developper pack of .Net 4.5.2. and switching target frameworks on my project to this in visual studio.