Upgrading your SharePoint 2010 Visual Studio projects and solutions to SharePoint 2013

Author: Tobias Zimmergren
http://www.zimmergren.net | http://www.tozit.com | @zimmergren

Introduction

Recently someone asked me about how to attack the major pain of upgrading their custom coded projects and solution from SharePoint 2010 to SharePoint 2013. Given that question and my experiences thus far I’ll try to pinpoint the most important things to consider when upgrading. There’s TONS of things you need to consider, but we’ll touch on the most fundamental things to consider just to get up and running. After that I’m sure you’ll bump into a few more issues, and then you’re on your way ;-)

Keep your developer tools updated

Visual Studio 2012 Update 1

The first step is to make sure that you’re running the latest version of Visual Studio 2012. As of this writing that means you should be running Visual Studio 2012 and then apply the Visual Studio 2012 Update 1 pack (vsupdate_KB2707250.exe) if it isn’t installed on your system already.

[blockquote]Download Visual Studio 2012 Update 1 here: http://tz.nu/Y28FCd [/blockquote]

Visual Studio 2012 Office Developer Tools

The second step is to make sure you’ve got the latest developer tools for SharePoint installed. The package comes as an update in the Web Platform Installer which I urge you to have installed on your dev-box if you for some reason don’t already have it installed.

So, launch the Web Platform Installer and make a quick search for “SharePoint” and you should see the new developer tools there (note that the release date is 2013-02-26, which is the release date for the RTM tools):

image

Select the “Microsoft Office Developer Tools for Visual Studio 2012” and click “Add“. It will ask you to install a bunch of prerequisites which you should accept if you want to continue:

image

Let the tools be installed and the components updated. This could take anywhere from a few seconds to a few Microsoft minutes. It took about 5 minutes on my current development environment, so that wasn’t too bad.

image

Once the tools are installed, you are ready to get going with your upgrade.

Open your projects/solutions after upgrading Visual Studio 2012 with the latest tools

When the tools have been successfully installed and you open your solution the new tools will be in effect. If you’re opening a SharePoint 2010 project that you wish to upgrade to SharePoint 2013, you’ll get a dialog saying “Do you want to upgrade <project name> to a SharePoint 2013 solution? Once the upgrade is complete, the solution can’t be deployed to SharePoint 2010. Do you want to continue?”

image

Hit Yes if you get this dialog. If you want to upgrade your project to SharePoint 2013.

Once the project is loaded and have made all the necessary changes to the project files (which it now does automatically, unlike in the beta/preview tools where we had to do some manual tweaks), you should get an upgrade report telling you how things went. Hopefully there’ll be no Errors, only warnings and Messages.

image

If you check out the assembly references in your project that are pointing to any SharePoint assemblies, note that they have automatically been updated to the correct version of the SharePoint 2013 assembly:

image

Additional notes

If you upgraded without the latest version of the developer tools you only had the option to launch your projects in 2013-mode if you manually went into the .csproj file to modify (or add if one of them were missing) the following two lines:

<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetOfficeVersion>15.0</TargetOfficeVersion>

This was true when the developer tools were in Preview/beta. But now when they’re released to RTM you shouldn’t be doing those manual hacks anymore. Trust the tools!

Tip: Some general code updates that may be required

When you deploy artifacts to the SharePointRoot folder in SharePoint 2013 they are now deployed to the /15 folder instead of the older /14 folder. SharePoint 2013 has a much better support for upgrade scenarios than previous versions of SharePoint (2010) which is why we’ve got the double hives. So, if you want to properly upgrade your solution you should also make sure to replace all the paths in your project from:

Path to the Images folder

From the images folder:

[blockquote]/_layouts/images/

To

/_layouts/15/images/[/blockquote]

Path to the layouts folder

Make sure to not forget the general layouts path:

[blockquote]/_layouts/

To:

/_layouts/15/[/blockquote]

Path to the ControlTemplates folder

Also make sure to replace the following paths:

[blockquote]/_controltemplates/

To:

/_controltemplates/15/[/blockquote]

Well you get the general idea here.. Should you find paths pointing to your old 14-hive instead of the new 15-folder, make sure to change the path/url.

Tool-tip

As always, you will not be an efficient developer without the proper tools at hand to make the daily tasks easier.

If you enjoyed using CKS Dev for SharePoint 2010 development, you’ll still be able to enjoy some of that awesomeness by simply installing the CKS Dev tools for SharePoint 2010 on your Visual Studio 2012/SP2013 box. They seem to work fine on Visual Studio 2012 as well – so until there’s a proper update of the tools, you’ll be able to knacker some of your code with the old tools.

Do note that there’s certain features of the CKS Dev that doesn’t work fully, so should you encounter issues with the tool in various scenarios that’ll most likely be because they’re not engineered for Visual Studio 2012 (yet).

Deploy-time

After you’ve done enough tinkering you’ll be ready to rock this baby up on SharePoint 2013.

Enjoy!

Follow me

Tobias Zimmergren

Founder / Consultant / Advisor at TOZIT AB
Tobias Zimmergren delivers high-quality articles about business and technology around the Microsoft scene.

Tobias focuses on advisory and consultancy for the Office 365 and SharePoint offerings from Microsoft.
Follow me
  • nicklas svensson

    nice!!

    • http://www.zimmergren.net/ Tobias Zimmergren

      Thank you Nicklas.

  • http://twitter.com/mattein Matthias Einig

    Hej Tobias!
    Great overview! Also think about replacing SPUtility.GetGenericSetupPath in your code, as it is obsolete in 2013. The new method to use is SPUtility.GetVersionedGenericSetupPath http://matte.in/XB2m58

    //Matthias

    • http://www.zimmergren.net/ Tobias Zimmergren

      Hi Matthias,
      Thanks.
      Sure there’s tons of things that has changed in the API’s as well, not only that path. I’ve bumped into tons of obsolete methods when migrating – but oftentimes there’s a newer method to utilize which we can quickly resort to – just like with the one you just mentioned :-)
      / tob

      • http://twitter.com/mattein Matthias Einig

        Hi Tobias,
        just tested that again for correct code generation in the SharePoint Software Factory (http://matte.in/SPSF2012) and realized that images are not in /_layouts/images/15 as you say, but in /_layouts/15/images

        Also you might want to add that links to language specific resources need to be fixed too i.e. _layouts/15/1033/images
        //Matthias

        • http://www.zimmergren.net/ Tobias Zimmergren

          Hi Matthias,

          Cheers – updated.

          Yep, essentially anything going into the SharePoint root needs to be corrected with a new path. Shouldn’t be too hard to figure out the path for all other resources, but perhaps I should make a list of all resources in the hive and list them, should anyone feel the need to look it up.

          Tob.

  • Mark_Q_Jones

    Nice post Tobias – thanks. I also had a stab at this subject, but I was using Visual Studio 2010 still : http://www.collaboris.com/blogs/collaboris-blog/mark-jones/2013/01/07/upgrading-a-custom-application-to-sharepoint-2013

    • http://www.zimmergren.net/ Tobias Zimmergren

      Hi Mark, thanks.
      Good post there, there’s tons to consider – this is just a scratch on the surface :-)

      • Mark_Q_Jones

        Oh blimey I have lost many hours on this stuff. We have the added complication that we need so support 2007, 2010 and 2013 from one code base. Wrote a long post on that.

        • http://www.zimmergren.net/ Tobias Zimmergren

          Lost many hours, or gained a lot of experience in troubleshooting – what’s the difference ;-)
          Jokes aside though, it can be a pain to do upgrades but my experiences thus far are pretty good. Not too many hickups yet.
          Just migraded a 22-project large SharePoint 2010 solution to 2013 without much problems. Now of course, the fun part of testing, verifying and troubleshooting begins ;-)

  • Pingback: Migrating Solutions to SharePoint 2013 | Dieter Bremes' Blog

  • Caroline

    Thanks a lot for this post! The only thing I still had to adjust afterwards was to set the SharePoint Product Version to 15.0 in the Package properties. (otherwise my files were set to the 14 hive). I’m not sure why the upgrade didn’t change this and may have been a project specific issue.

    • http://www.zimmergren.net/ Tobias Zimmergren

      Hi Caroline,
      I’m glad you got it up and running – the new and upgraded tools are doing a lot of the work for us in terms of configuring the properties. In my cases I haven’t had to change the product version either, but looks like it may be necessary in some cases.
      Cheers,
      Tobias.

  • http://blogs.msdn.com/b/torstenmandelkow/ Torsten Mandelkow

    Hi Tobias,

    Thank you for this post. Initiated by it we added several rules to SharePoint Code Analysis Framework (SPCAF) to check all files in WSPs (.dll. .xml, .aspx, .master, .css, .xslt, .js…) for compatibility to SP 2013.

    See here a list of all applied rules: http://go.spcaf.com/10Fh1mX

    Maybe you could try the analysis after your migration and check your code for completeness. Get the tool here: http://go.spcaf.com/VSGallery
    Any feedback is welcome.

    Cheers,
    Torsten

    • http://www.zimmergren.net/ Tobias Zimmergren

      Thanks Torsten.
      Looks great – I’ll give it a whirl!

      Tob.

  • emzero

    Excellent post Tobias! Maybe you could help me with something. I had a 2010 solution that has a WCF service using the CKS template (the one that uses the factory and no extra XML): http://ranaictiu-technicalblog.blogspot.com.ar/2011/03/sharepoint-2010-create-custom-wcf.html

    Problem is when I migrated to 2013, the wcf is broken. It can’t find the [BasicHttpBindingServiceMetadataExchangeEndpoint] attribute that used to be in Microsoft.SharePoint.Client.Services (there’s no Services namespace now). Any idea of where that class could have been moved? Or which changes do I need to make to fix the WCF service?

    Thank you!

  • Pingback: SharePoint 2013 Development & Performance » Visual Studio 2012 or 2010 for SharePoint 2010 Development?

  • Pingback: itgroove Blogs » Visual Studio 2012 or 2010 for SharePoint 2010 Development?

  • Pingback: Moving my custom farm solutions from sharepoint 2010 to sharepoint 2013 error | Question and Answer

  • Vipul

    Hi Tobias

    We have upgraded a visual studio 2010 solution to visual studio 2010..however, each time we open the solution by double clicking the solution file, the upgrade log files are getting generated each time in the solution folder.
    Is the solution not upgraded successfully ? What is going wrong here ?

    • Vipul

      Small typo here :)
      We have upgraded a visual studio 2010 solution to ** visual studio 2012

  • Jeremy Bond
  • Pingback: Visual Studio always upgrade my solution | Andy Burns’ SharePoint Blog

  • viral

    I want to keep my codebase same for sharepoint 2013 and sharepoint 2010 solution. Sharepoint 2013 requires version 4. but 2010 supports 3.5 max. So how can do I do this? Do I need to use separate set of sharepoint dlls or I can use same set of dlls (ver14) with both?

  • Pingback: Preparing for upgrade to SharePoint 2013 – Iterative Upgrade Process | Tobias Zimmergren's thoughts on development

  • Rooba selvendiran

    HI Tobias,i followed your step while upgrading from sharepoint 2010 to 2013 . we have bunch of custom solutions(which has custom layouts,many custom webpart and custom user controls,custom masterpages) and all goes good now. your steps are really helpful for us to complete our upgrade without any issues.Thankyou.

    Rooba

    • http://www.zimmergren.net/ Tobias Zimmergren

      Hi Rooba,
      Thank you for the comment – I’m glad you could upgrade without hassle.
      Tobias.

  • Pingback: Upgrading your SharePoint 2010 Visual Studio pr...

  • Nadeem Yousuf

    Thanks for the nice article. It helped me convert my two SP 2010 codeplex projects to SP 2013: http://sharepointnadeem.blogspot.in/2013/12/sharepoint-2013-upgrade-sharepoint-2010.html

    • http://www.zimmergren.net/ Tobias Zimmergren

      Hi Nadeem,
      Thank you for the comment – glad it helped :-)
      Tobias.

  • Pingback: Upgrade SharePoint 2010 webpart solution to 2013 | BondByte Inc

  • Noor

    I followed the steps but still I am not getting any migration message while opening sharepoint 2010 project.

    • http://www.zimmergren.net/ Tobias Zimmergren

      Did you open the project in Visual Studio 2012/2013?

  • Megh

    Microsoft Minutes. Loved that!!!

    • http://www.zimmergren.net/ Tobias Zimmergren

      Glad you liked it. After so many years with Microsoft tech, you learn that some things never change ;-)

  • Dirk Löhn

    Great advice, helped a lot.
    One additional thing to do if you want things deployed in the 15 Hive is to change the SharePointVersion=”15.0″ in the package.xml, as I found here: http://www.learningsharepoint.com/2013/03/24/deploy-sharepoint-2010-solutions-in-sharepoint-2013/
    Not easy to find, you need to open the package in VS and then manually edit the generated manifest. Well at least that worked and helped me to migrate some Codeplex code.