How to run application as administrator in debug with Visual Studio?

Just run visual studio itself as an administrator. Any program you debug from there will also be run as an administrator.


You can also set this administrator option automatically:

enter image description here


VS must be run with admin right. however, a more elegant way is in the requiredExecutionLevel in manifest should set to 'requireAdministrator'.

<requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />

When you open the project and try to debug, the VS2012 will warn about the admin right and restart itself to admin right. And also the exe file will be marked as requiring admin right at the first place therefore when deploy you don't need to configure admin right requirement in file properties.


To answer the question in your title, you can just select Run as Administrator from the context menu when starting VS.