Using Sharepoint 2010, I am trying to use the SPWebConfigModification class to add connection strings the the sharepoint's web.config.

My problem is that the class SPWebConfigModification is not recognized at compile time by Visual Studio because the Microsoft.Sharepoint.dll assembly containing its namespace collides with another assembly with the same name. The two assemblies are:

  • C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SharePointTools\ReferenceAssemblies\14\Microsoft.SharePoint.dll (the bad one)
  • C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint.dll (the one i'm expecting to be linked with my project)

I do not understand why the first one is preferred over the other one during build. I even tried to put the good one in my project folder, but the problem remains...

Do you have any idea?

Here is my configuration:

  • Visual studio 2012
  • .Net 3.5
  • Sharepoint foundation 2010
  • Sharepoint 2010 SDK

Thanks a lot.

2 Answers 2


I found the problem: my solution was in Sandboxed mode! Changed the "Sandboxed solution" project's property to False and now it compiles :)

  • This was a nice find - Visual Studio gives absolutely no hints why it refers to the wrong one. I found my reference path was correct, but the object browser took me to a completely different DLL. What a headache!
    – Ian
    Commented Jan 16, 2013 at 13:33

Sounds like the SharePoint tools that got installed with Visual Studio 2012 need to be uninstalled.

I would then follow these steps to get the templates needed which enable both 2010 and 2013 SharePoint development:


Note: when downloading the client SDK, make sure it's not the preview version.

  • Thank you for your answer. Do you know how to uninstall them? I tried to uninstall "MS VS 2010 Tools for office runtime", but it does not look to be this one :)
    – user13134
    Commented Nov 22, 2012 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.