32

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 want 2008 solutions to open with 2010. Does anyone know what the problem might be and how to fix it?

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Jonas Stawski
  • 6,682
  • 6
  • 61
  • 106

3 Answers3

39

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.

Gene Merlin
  • 882
  • 7
  • 5
  • that is exactly how i have my environment set up. Is there any way to fix this issue? – Jonas Stawski Jul 29 '10 at 05:51
  • 1
    Thank you! I used this solution to solve an issue on my system where .vsix would not install on my machine with VS 2013 & VS 2015. I would double click vsix and it would not do anything. After researching ways to install vsix files manually I could not find a way and then looked into fixing this magical "visual studio version selector". I couldn't find much on this issue with vsix - but your answer solved it. – Jon Kragh Jul 26 '15 at 18:57
28

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
Jorge Poveda
  • 774
  • 9
  • 12
  • 3
    What sucks about this is that the signature of the file is now modified and Windows doesn't show the known publisher prompt, instead it shows the unknown publisher (Yellow box) prompt. I guess it is ok as it works and I know i can trust it anyway. – Jonas Stawski Aug 09 '11 at 03:09
0

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.

Matt Whipple
  • 7,034
  • 1
  • 23
  • 34