开发者

Visual Studio Version Selector Doesn't open

I have Visual Studio 2008 and 2010 installed side by side, but trying to open either a 2008 or 2010 sln file results in nothing. The hour glass comes on for about a second and then it goes away and nothing is opened.

I read somewhere to relate sln file to VS directly, but I can't go that route because I don't wa开发者_如何学Cnt 2008 solutions to open with 2010. Does anyone know what the problem might be and how to fix it?


If you are running Vista or Windows 7 with the UAC enabled and have "Run this program as an Administrator" checked on the Compatibility tab for the Visual Studio exe (devenv.exe), you will get this behavior when you try to open a sln file directly from Windows Explorer.

One solution is to go to "%ProgramFiles%\Common Files\Microsoft Shared\MSEnv" or ("%ProgramFiles(x86)%\Common Files\Microsoft Shared\MSEnv" for 64-bit systems) and right-click VSLauncher.exe and select Properties. On the Compatibility tab, check "Run this program as an Administrator". Now when you try to open a sln file directly from Windows Explorer, you will get the elevation prompt and it will open the correct version of Visual Studio for the file.


Apparently, the "run as administrator" hack does not work anymore in Visual Studio 2010 SP1. Fabian describes a workaround here:

Getting Visual Studio 2010 SP1 to run elevated when launching .sln files

To sum it up:

  1. Backup VSLauncher.exe

  2. From within a Visual Studio 2010 Tools prompt, extract the manifest from VSLauncher.exe:

    mt -inputresource:"VSLauncher.exe" -out:VSLauncher.exe.manifest
  1. Alter the VSLauncher.exe.manifest file:
    <requestedPrivileges>
       <requestedExecutionLevel level="requireAdministrator" uiAccess="false">
       </requestedExecutionLevel>
    </requestedPrivileges>
  1. Write back the manifest into VSLauncher.exe:
    mt -outputresource:VSLauncher.exe -manifest VSLauncher.exe.manifest


The really annoying thing about this problem is that you have to run Visual Studio as administrator under windows 7 to attach to an IIS instance. The least they could do was not break the .sln files when you do that!

The post by Jorge Poveda is correct though, the original hack no longer works but his does. It's maybe worth mentioning that you have to run everything as administrator for it to work (the command prompt and text editor).

I think there is a better way though as we have Win 7 at work which runs as administrator and didn't have this issue. The key difference is that with this fix, the admin prompt asks you to open VSLauncher.exe, but on my work machine, it asks to open devenv.exe so VSLauncher must be OK to open VS2010 somehow. I'll ask our infrastructure guys how they did it and post back.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜