When I'm running Visual Studio as admin, and I use it to run my C# application, it automatically runs the application as admin.
This causes problems when it tries to use interop, because instead of connecting to running processes, it launches new ones as admin.
It's an easy mistake to make, and debugging doesn't help catch it.
I'd like to make sure the application runs at a lower UAC level, or stop it from running at all if the permissions are wrong.
I'm aware of <requestedExecutionLevel>
in the application manifest. The problem is that the only level
s it seems to provide are asInvoker
, requireAdministrator
, and highestAvailable
. As far as I can tell, these only raise the level, not lower it.