Every time I am starting a new demo project, and trying to prove something quickly, this error gets me:
The type or namespace 'Xrm' does not exist in the namespace 'Microsoft'
What? How is that possible, I know I have added a reference to Microsoft.Xrm.sdk.dll assembly, I tripled checked that.
The problem is, by default new Visual Studio client projects (Console Application, Windows Form and so on) are set to use the .NET Framework 4 Client Profile, which is a subset of the .NET Framework that was optimized for client applications.
Unfortunately, to work with CRM you need the full version of the .NET Framework. So, to fix this issue, just set the Project Target Framework to .NET Framework 4 and you should be good to go.
Starting with the .NET Framework 4.5, the Client Profile has been discontinued and only the full redistributable package is available. Optimizations provided by the .NET Framework 4.5, such as smaller download size and faster deployment, have eliminated the need for a separate deployment package. The single redistributable streamlines the installation process and simplifies your app's deployment options.
When you install the .NET Framework 4.5, the .NET Framework 4 Client Profile is updated to the full version of the .NET Framework.
Source: MSDN