Today I received two errors when developing a new project for SharePoint 2010.
The first one was the FileNotFoundException on the SPSite constructor. Turns out that VS2010 defaults to a x86 setting for for instance console apps. This needs to be x64 since SharePoint 2010 is x64 only; switch it.
The second one was “microsoft sharepoint is not supported with version 4.0.30128.1 of the Microsoft .Net runtime”, a PlatformNotSupportedException. Weird one, but the MSDN forum post here solved it for me. You need to add the following to your registry:
@=”C:\\Program Files (x86)\\Microsoft Chart Controls\\Assemblies”
Then switch your framework versions back to 3.5 and you’re good to go. I assume this all will be fixed in the final RTM version of SP2010.
Update: unfortunately, it seems it won’t be fixed. Because .NET 4.0 is being released at roughly the same time as SharePoint is, the team didn’t got the chance to build SharePoint on top of .NET 4.0. It’s a shame, but it looks like were bound to 3.5 when it comes to SharePoint development.