Convert SharePoint 2010 Solution to 2013 and Visual Studio 2012

sharepoint-2010sharepoint-2013visual studio 2010visual studio 2012

I am trying to convert a SharePoint 2010 solution (custom web parts, content types, lists, event receivers, etc.) developed in Visual Studio 2010 to SharePoint 2013 and Visual Studio 2012. When I open the project in VS 2012, it converts a couple of the project files but won't compile because of reference issues.

I copied the DLLs (mostly Microsoft.SharePoint…, although I needed to copy the Microsoft.Office.SecureStoreService.dll too) that were causing issues from my 2010 server to the 2013 server and fixed the references. However, the Microsoft.Office.SecureStoreService.dll still gives me compiler errors claiming "Error 203 The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)" when visual studio has no problem with the namespace and finds the SecureStoreProvider class inside it just fine.

I've also tried to change the target framework from 3.5 to 4 and only see "Install other frameworks…" in the target framework dropdown.

I'm sure that others have dealt with this, but have been unsuccessful in framing the right google search query. I'm relatively new to SharePoint in general and any help would be appreciated.

thanks,

Mike

Best Answer

I was able to get my solution upgraded from a 2010 project to 2013 using the following. Note that this will update your solution to use the new 2013 API. It is possible to update just the project file but still run in 2010 mode.

First edit your .csproj file (for c#).

Modify the target framework to this: <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

Add this a node for the office version, I put mine directly below the TargetFrameworkVersion tag <TargetOfficeVersion>15.0</TargetOfficeVersion>

Update references

Reload the project and update your referenced assemblies. If you haven't specified a specific version they should already be referencing the v15 (SharePoint 2013) assemblies.

Do a find replace for 14.0.0.0 to 15.0.0.0. This updates any references on your pages, layouts, and master pages to the v15 assemblies.

Change calls

Change any calls to SPUtility.GetGenericSetupPath() to SPUtility.GetVersionedGenericSetupPath()

Check each file to do a check for any hive references. You'll need to add a /15/ to these. EG: _layouts/ to _layouts/15/

Open the package "folder" in visual studio then update the properties for that package to use version 15.

Clean up

Finally do a compile clean up any missed items. Deploy your solution and make sure to test thoroughly.