Debugging with Visual Studio 2012, Windows 8 and U

2019-04-29 21:13发布

问题:

First of all - this is all about the RTM Versions. And Windows 8 has some changes regarding the UAC, as we all learned from http://www.brianbondy.com/blog/id/140/, it cannot be disabled side-effect-free.

Now the problem starts: Our main app requires elevated privileges (at least the server part). Debugging will only work when running VS in elevated mode, too. But when I'm starting a Silverlight Project in elevated mode of VS, the IE fired up for debugging is started as with normal privileges and debugging is not possible, too. To make things more complicated, we're not running solutions with all (700+) projects loaded, but do lot of our dev-stuff (compiling, starting, testing) in command line. Which needs to be elevated, too.

What is the correct configuration of UAC for this purpose: I want to be able to debug Silverlight applications running in Internet Explorer, Applications of any kind started by VS "F5", a server process started from commandline and (maybe) C#/XAML Metro-Apps?

In Windows 7 it was just disabling UAC and everything's fine. Now I feel like fighting against my own toolset and have a bad feeling about this.

And please - do not tell me that UAC is important and useful. I'm totally okay with it, but for a developer things are slightly different.

回答1:

See this answer on Superuser:

The Only way I'm aware of which ensures it will always open as Administrator (including when you open from file associations, jump list etc) is:

  1. Locate the devenv.exe file in Explorer eg mine is in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\

  2. Right-click devenv.exe and choose "Troubleshoot compatibility"

  3. Select "Troubleshoot program"

  4. Select "This program requires additional permissions"

You'll need to let it launch VS before it lets you click Next, but then you're done.

EXTREMELY annoying that you can't just do this through the normal properties dialog any more. It's like Microsoft are going out of their way to ensure Windows 8 alienates as many people as possible...



回答2:

Have you tried installing VSCommands and using the Always start Visual Studio with elevated permissions option? I'm not sure how this would function differently than restarting with elevated permissions but it can't hurt to try.

I ran into the same issues with the command line, debugging, and other things such as once you're running with elevated permissions you can no longer drag & drop files into Visual Studio, or open files associated with Visual Studio when it's set to always run with elevated permissions. This is why I've always disabled UAC.

In the end I just turned off UAC in the registry. I'm not missing out on anything by doing so. It would be nice to hear how Microsoft uses the Win8 + VS2012 combo internally after seeing how broken it feels.