Visual Studio 2010 Can’t open new SPSite object

Using Visual Studio 2010, I come across an FileNotFoundException when creating a WPF application. The exception happened with the below snip of code:

using(SPSite  site = new SPSite(“http://phillau”))

I read another post that told me to run Visual Studio 2010 with Administrator privileges so I did. It did not fix the problem.

So I went into the csproj properties and checked out what platform my project was targeted at. I changed it from x86 to x64 because I was working in a x64bit environment. Then I came across a PlatformNotSupportedException.

I went into the csproj properties again and changed the .Net version from 4 to 3.5. .Net 4 has not been deployed to in my work environment.

Rebuilt the project and SUCCESS 🙂


  1. OS: Windows Server 2008 R2
  2. SharePoint 2010
  3. Visual Studio 2010