1

I've got a SharePoint 2013 VM for development using Visual Studio 2013. I've deployed an "old" 2010 wsp containing a visual webpart for using it within site collections running in 2010 mode in my 2013 SharePoint.

Now I've got the "old" 2010 C# source code and I want to debug the webpart running in these 2010 mode site collections.

But I'm not able to build and deploy the 2010 solution with my Visual Studio 2013: I receive a lot of compiler warnings, saying that all references to Microsof.SharePoint.* and Microsoft.Office.Server.* cannot be resolved.

Is there a simple way to just debug 2010 solutions in a 2013 environment? Maybe using old pdb-files? I don't want to upgrade and rebuild the old projects, just debug them.

  • Have you made sure the SharePoint dll versions are supported on your environment? – user2536 Apr 29 '14 at 12:42
  • Ahmm ... What do you mean exactly? Copying the 2010 dlls to the "stripped down" 14-hive of the 2013 environment? I haven't done something like that. – jcp Apr 29 '14 at 13:06
  • I mean are the SharePoint DLLs referred in your project present in the windows assembly folder or GAC_MSIL folder on your server? If not, have you tried referring to the 15.0.0.0 version of the DLLs instead since you are now on a SP2013 VM? – user2536 Apr 29 '14 at 13:09
1

There are few things you will have to change in order for your solution to be deployed on SharePoint 2013.

  • Make sure that target framework for your solution is .Net Framework 3.5 (or above).
  • Update SharePoint Product version to 15.0 so that all your files gets deployed to 15 Hive and not 14 hive.

enter image description here

  • So I have to build and deploy the code as a "15 solution" again to debug the already installed 2010 wsp file? Will the new 15 solution really run in 2010 mode sites? Please note: I don't want to upgrade the 2010 solution, just debug it running in 2010 mode on a 2013 farm. – jcp Apr 29 '14 at 15:54
  • @jcp in that case just make sure your solution is targeting the right framework. You may have to update the reference to SharePoint assemblies in your solution. – Sudhir Kesharwani Apr 29 '14 at 17:43
1

Preface

As is described in my initial question I just want to debug custom SharePoint 2010 solutions running in 2010 mode on a SharePoint 2013 farm. This answer is not about changing and re-compiling 2010 code in a 2013 environment.

Requirements

You need at least these artifacts to debug your 2010 solution:

  • Source code of your solution
  • The corresponding wsp-package
  • The corresponding pdb-file for the wsp-package (in fact this is the most important bit; see next)

Getting the pdb-files

The pdb-file is essential for debugging. (Definition see here or here). This great blog article from John Robbins "PDB Files: What Every Developer Must Know" describes in detail how to get the right pdb-file using the dumpbin /headers command from the Visual Studio tools.

Unfortunately I didn't keep the pdb-file for my 2010 wsp-package I deployed to the 2013 farm. But fortunately I still have access to a SharePoint 2010 VM with Visual Studio 2010. Here is how I generated the needed pdb-file then:

  1. Get the source code of your solution
  2. Do a new, clean build and deploy the solution to the 2010 environment from Visual Studio so that a wsp-file is generated.
  3. Grab the generated dll-file and wsp-package located under \bin\Debug.
  4. Inspect the generated dll-file with dumpbin /headers to obtain the information about the needed pdb-file. (In my case I had to use the pdb-file located unter \obj\Debug not \bin\Debug.) Grab that pdb-file. Make sure the pdb-file was actually generated for the dll/wsp build before: pdb, dll and wsp should have the same timestamp.

Deploying the solution to SharePoint 2013

Now copy the source code, the wsp-Package and the pdb-file to your 2013 environment.

  1. Deploy the wsp-Package to your 2013 environment as usual using PowerShell / CA.
  2. Copy the pdb-file to the exact location the dumpbin /headers command told you (see above). The blog article of John Robbins says that there are better places to store your pdb-file but copying it to the exact location did it for me.

Debugging

  1. Open the source code project in Visual Studio and do not upgrade the project to 2013.
  2. Just attach to the IIS worker process(es). No need to build the code.

The symbols from the pdb-file should be loaded so that you can debug your solution. See Debug > Windows > Module from the menu while debugging to check if the pdb-file is loaded.

Now you should be able to debug your 2010 solution running in 2010 mode in a 2013 environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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