Search This Blog

Thursday, March 19, 2015

Convert SharePoint 2010 solution to SharePoint 2013 in Visual Studio


Recently I tried to convert a SharePoint solution in visual studio 2010 to Visual Studio 2012, but it gave me errors like:

"The primary reference "Microsoft.SharePoint" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework."

You can refer to below steps if you want to convert your SharePoint 2010 solution (created with visual studio 2008 or 2010) to visual studio 2012 for SharePoint 2013: 
  • Open your visual studio .csproj file in notepad or visual studio and change the value of  tag "TargetFrameworkVersion" to 4.5

  • Add a new tag just below the one you modified in above step as:
        <TargetOfficeVersion>15.0</TargetOfficeVersion>

This way your modified csproj file will have attributes as shown below:


  • You will also need to change the SharePoint Product version property of your  Package file from 14.0 to 15.0 as shown below. 
  •  In your aspx pages and code files, where you are referencing any image from Layouts folder, you need to append "/15" as:
           /_Layouts/15/<your image path>

No comments:

Post a Comment