I have never seen any option for that but if it exists you would need to provide a valid admin login. So if you have access to an admin account why not just login as admin (or start another IDE using run as)?
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan
The way it's set up, I'm using the IDE under a Standard User account so if I run the IDE as an administrator I will lose all the settings inside the Visual Studio. I agree that this is one way to do it, but the whole idea of setting up VS from scratch defeats the purpose.
So, I guess I'll stick with what I'm doing now. Which is adding a manual breakpoint to the code using DebugBreak(). I then run the compiled code from Windows Explorer using Run as Administrator command, after which I attach the VS debugger thru the JIT debugger option. As you see this is far from being simple and handy.
PS. Of course, if breaking the code isn't required right at the start, I attach to my process with the VS debugger later.
I played around a bit and actually came up with something that at least save you some manual steps. If you change Debugging settings to:
Command: runas
Command Arguments: /user:XXXX $(TargetPath)
your app will be executed with other credentials.
If you need to break at a specific location just insert
Code:
__asm {
int 3;
}
and when it's reached you will be asked if you want to attach to the process.
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan
Thanks. The DebugBreak() actually does just that. I mean int 3 part. I tried your approach with command line, but it doesn't really help because I will also need my own command line in this project. So I guess my only viable approach is to play with manifests and request elevation there (and then edit it out when I don't need it).
I've switched to VS 2008 just recently, so I'm curious, is adding of a manifest automated in it? Or do I still have to add it manually?
Without having tried I guess you can add the requested command line arguments after $(TargetPath)
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan
OK, I tried the manifest elevation and it still wants to restart the IDE under administrative account when I chose Debug command. It seems that there's no easy way around it.... Thanks for your help.
Bookmarks