Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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:

http://yalla.itgroove.net/2012/08/sharepoint-2013-project-templates-for-visual-studio-2012/

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

share|improve this answer
    
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 :) –  Josselin Auguste Nov 22 '12 at 8:59
up vote 2 down vote accepted

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

share|improve this answer
    
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 Jan 16 '13 at 13:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.