I’m having trouble creating a sharepoint project with .net 4.0.
Using Visual Studio 2010, when I attempt to create a new “Empty SharePoint Project”, I select “.NET Framework 4” under the .net version dropdown list (actually it’s the default selection), and then i click ok. When I look at the “Target framework” property in my package properties, it says “.NET Framework 3.5” and does not list any other versions.
I have assured that .net 4.0 is installed, and I even have another Class Library project under the same solution with version 4.0. I also tried it on a different machine, and the same thing happened. What is going on?
screenshots:
creating a new sharepoint project
newly created sharepoint project properties
other class library project in the same solution successfully using version 4
SharePoint 2010 is built to use v2.0 of the .NET CLR (which is used by .NET Framework 2, 3 and 3.5). .NET 4 uses a different CLR and thus is incompatible with SharePoint insofar as developing solutions to run inside SharePoint.
You can build .NET 4.0 applications that call SharePoint’s web services, use the client object model, or even run under a virtual directory under SharePoint. But you’re stuck using 3.5 for an actual solution.