Project with CRM reference not compiling?

Did you reference a CRM assembly in your project, and it doesn't compile because it can't find types such as Entity or CrmConnection even though your intellisense shows them just fine? Odds are you are targeting the wrong framework version.

I found that from v7, the framework should be 4.5.2

Recently I pulled CRM core assemblies v7.1.0 from NuGet and pasted some code from a different project and for some reason it refused to compile. I tried v6.0.0 (which also put some garbage in my solution I wasn't happy with) and the compiler gave no errors.

In the end I put back the v7.1.0 and in the project properties I changed the Target Framework from 4.5 to 4.5.2. This time the project compiled.

In any case, since Microsoft will stop supporting framework version 4, 4.5, and 4.5.1, you shouldn't be targeting them for new projects in any case.