Running visual studio as administrator is often required, especially if you use IIS as a host for your web site. Therefore, I like it to be started as an administrator by default. So instead of right clicking it and selecting ‘run as administrator’, you can hack it a little bit so that it always starts as administrator, no matter how you start it.
Step 1: change ‘devenv.exe’ compatibility
First go to C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE, right click on ‘devenv.exe’ and select properties, click ‘compatibility tab’, check ‘Run this program as an administrator’, and click ‘OK’:
Step 2: hack VSLauncher.exe
You have to hack VSLauncher.exe a little, because changing its compatibility settings won’t work with visual studio 2010:
- Backup C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VSLauncher.exe
- From within a Visual Studio 2010 Tools prompt (run as admin), extract the manifest from VSLauncher.exe:
mt -inputresource:"VSLauncher.exe" -out:VSLauncher.exe.manifest
Alter the VSLauncher.exe.manifest file:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false">
- Write back the manifest into VSLauncher.exe:
mt -outputresource:VSLauncher.exe -manifest VSLauncher.exe.manifest
If you now start visual studio by its shortcut or by opening a solution file, it will start as an administrator.