Recently I was assigned to Migrate code which used to develop SharePoint 2010 web parts to SharePoint 2013 web parts. Here I will illustrate how I did it.
Solution
Step 01: Open the Visual Studio 2010 (SharePoint 2010) solution in Visual Studio 2012.
Step 02: Change the Target framework to .Net Framework 4.5
Step 03: Remove all the SharePoint 2010 assemblies and add SharePoint 2013 assemblies. This is because SharePoint 2010 assemblies are located in 14 hive and in SharePoint 2013 the assemblies are located on 15 hive. The SharePoint dlls can be
- Microsoft.Office.Server.dll
- Microsoft.SharePoint.dll
- Microsoft.SharePoint.Security.dll
There are others as well. Please refer MSDN for other common used SharePoint assemblies.
Step 04: Change Control templates/ web part location as below.
FromStep 05: Change the _layouts location files to /_layouts/15/ location. Usually images, CSS and JavaScript files are added to _layouts folder.
~/_CONTROLTEMPLATES/{Folder Name}
To
~/_CONTROLTEMPLATES/15/{Folder Name}
ImagesStep 06: In all aspx pages you have to change the reference from SharePoint 2010 asssembly to SharePoint 2013 assemblies. To do this change the assembly version from Version=14.0.0.0 to Version=15.0.0.0
From
/_layouts/images/
To
/_layouts/15/images/
CSS
From
/_layouts/{Folder Name}/css
To
/_layouts/15/{Folder Name}/css
JavaScript
From
/_layouts/{Folder Name}/scripts
To
/_layouts/15/{Folder Name}/scripts
Example.
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
To
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
Conclusion
Hope this will work for you and please note that sometimes you will need to change the deployment path according to SharePoint 2013. As the above add 15 hive after the mapped folder. If you have set the master page as v4.master you should change to seattle.master
Nice Article
ReplyDeleteIn my company, Sharepoint 2010 is recently migrated into Sharepoint 2013 with the help of SysTools SharePoint Organizer. Earlier I was thinking that there is not any manual way for this. But after reading this article I believe that it is manually possible.