visual-studio Visual Studio 版本选择器未打开
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3304425/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Visual Studio Version Selector Doesn't open
提问by Jonas Stawski
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.
我并排安装了 Visual Studio 2008 和 2010,但尝试打开 2008 或 2010 sln 文件没有任何结果。沙漏亮了大约一秒钟,然后消失了,什么也没有打开。
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?
我在某处阅读将 sln 文件直接与 VS 相关联,但我不能走那条路,因为我不希望 2008 年的解决方案在 2010 年打开。有谁知道问题可能是什么以及如何解决它?
回答by Gene Merlin
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.
如果您在启用了 UAC 的情况下运行 Vista 或 Windows 7 并在 Visual Studio exe (devenv.exe) 的兼容性选项卡上选中了“以管理员身份运行此程序”,则当您尝试打开 sln 时,您将出现此行为文件直接从 Windows 资源管理器。
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.exeand select Properties. On the Compatibilitytab, 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.
一种解决方案是转到“%ProgramFiles%\Common Files\Microsoft Shared\MSEnv”或(对于 64 位系统为“%ProgramFiles(x86)%\Common Files\Microsoft Shared\MSEnv”)并右键单击VSLauncher.exe并选择属性。在兼容性选项卡上,选中“以管理员身份运行此程序”。现在,当您尝试直接从 Windows 资源管理器中打开 sln 文件时,您将获得提升提示,并且它将为该文件打开正确版本的 Visual Studio。
回答by Jorge Poveda
Apparently, the "run as administrator" hack does not work anymore in Visual Studio 2010 SP1. Fabian describes a workaround here:
显然,“以管理员身份运行”hack 在 Visual Studio 2010 SP1 中不再起作用。Fabian 在这里描述了一种解决方法:
Getting Visual Studio 2010 SP1 to run elevated when launching .sln files
启动 .sln 文件时让 Visual Studio 2010 SP1 运行提升
To sum it up:
把它们加起来:
Backup VSLauncher.exe
From within a Visual Studio 2010 Tools prompt, extract the manifest from VSLauncher.exe:
备份VSLauncher.exe
从 Visual Studio 2010 工具提示中,从 VSLauncher.exe 中提取清单:
mt -inputresource:"VSLauncher.exe" -out:VSLauncher.exe.manifest
- Alter the VSLauncher.exe.manifest file:
- 更改 VSLauncher.exe.manifest 文件:
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false">
</requestedExecutionLevel>
</requestedPrivileges>
- Write back the manifest into VSLauncher.exe:
- 将清单写回 VSLauncher.exe:
mt -outputresource:VSLauncher.exe -manifest VSLauncher.exe.manifest
回答by Robin French
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 .slnfiles when you do that!
这个问题真正令人讨厌的是,您必须在 Windows 7 下以管理员身份运行 Visual Studio 才能附加到 IIS 实例。.sln当您这样做时,他们至少可以做的就是不要破坏文件!
The post by Jorge Povedais 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).
虽然Jorge Poveda的帖子是正确的,但最初的 hack 不再有效,但他的有效。值得一提的是,您必须以管理员身份运行所有内容才能使其工作(命令提示符和文本编辑器)。
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.exeso VSLauncher must be OK to open VS2010 somehow. I'll ask our infrastructure guys how they did it and post back.
我认为有更好的方法,因为我们有 Win 7 在工作,它以管理员身份运行并且没有这个问题。关键区别在于,使用此修复程序时,管理员提示要求您打开VSLauncher.exe,但在我的工作机器上,它要求打开,devenv.exe因此 VSLauncher 必须可以以某种方式打开 VS2010。我会问我们的基础设施人员他们是怎么做的,然后回帖。

