Recently I had an opportunity to troubleshoot and fix an issue with not being able to perform F5 debugging using Visual Studio Professional 2012 with “any” SharePoint 2013 project types.
We were able to manually attach VS debugger to the SharePoint process (w3wp.exe) and debug it, however, if we press F5 (or DEBUG –> Start Debugging from VS), we see the following message box in VS.
Here’s some information on the environment where we were facing this issue.
Visual Studio Professional 2012 version 11.0.50727.1 with Microsoft Office Developer Tools for Visual Studio 2012 ENU version 11.0.60226.0.
Microsoft Team Foundation Server 2013 Update 2 version 12.0.30324.0.
Team Explorer for Microsoft Visual Studio 2013 version 12.0.21005.13.
On debugging this I found that the VS debugger process (msvsmon.exe) couldn’t attach to the w3wp.exe process (I was testing with a Visual WebPart project that runs on w3wp.exe) because it couldn’t load the following debugger component:
Microsoft.Workflow.DebugController, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Checking the GAC, I saw an earlier version of this DLL installed.
I don’t know the exact reason why this problem happens with SharePoint project types (and only with SharePoint project/item templates, because F5 debugging works fine for other VS project/items templates). But my best guess is that Office Developer Tools is not looking at the right place to determine which version of Microsoft.Workflow.DebugController it should use at run time.
The fix turned out to be simple. VS debugger process C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Remote Debugger\x64\msvsmon.exe was trying to load the incorrect version of debug controller (of course, as dictated by Office Developer Tools). I found there’s configuration file MSVSMON.EXE uses also located in the same path pointed out above C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Remote Debugger\x64\msvsmon.exe.config. The default entries in this config file is shown below.
I just added an <assemblyBinding/> element and redirected calls to 126.96.36.199 version of Microsoft.Workflow.DebugController to 188.8.131.52 version as shown below.
Closed all instances of Visual Studio Professional 2012 and opened it. Now F5 debugging for all projects (including SharePoint) works like charm!
Hope this helps!