Launching Visual Studio from WebMatrix 2 opens wro

2019-03-25 09:28发布

问题:

I'm using Microsoft WebMatrix 2 to work on a simple ASP.NET WebPages site. When you are in the Files view, there is a Visual Studio Launch button that should open up the site Solution in Visual Studio 2012. On my machine I also have Visual Studio 2010 installed and that is the version that gets opened when I click on the button.

How can I make sure that Visual Studio 2012 is opened?

I'm working on Windows 8 but I am pretty sure this applies to Windows 7 and XP as well. I suspect I may have installed 2012 before 2010 which may explain how my machine got into this state but I can't remember for sure.

回答1:

Thanks to Mike Brind for the technical details of the solution in his blog post WebMatrix Opens Wrong Version Of Visual Studio.

Basically you need to update these registry entries to point to the correct version of Studio. Remember to be careful when modifying the Windows Registry!

HKEY_CLASSES_ROOT\VisualStudio.DTE\CLSID
HKEY_CLASSES_ROOT\VisualStudio.DTE\CurVer

Running the commands below will backup the registry entries first and set the values to be Visual Studio 2012. You will need to open an administrator / elevated priviledge command prompt to execute them.

reg export HKEY_CLASSES_ROOT\VisualStudio.DTE %HOMEPATH%\Documents\VisualStudio.DTE-RegistryKeyBackup.reg
reg add HKCR\VisualStudio.DTE\CLSID /ve /d {059618E6-4639-4D1A-A248-1384E368D5C3} /f
reg add HKCR\VisualStudio.DTE\CurVer /ve /d VisualStudio.DTE.11.0 /f