2017-06-13

Always run Visual Studio as administrator

I am using Visual Studio a lot, and when I pin it to the task bar in Windows 10, right-clicking it will bring up a (popup) list of my last opened projects.

I need to run VS as Administrator, to be able to debug my web applications running on the local IIS.

So when I right-click the pinned VS-icon on the task bar, I can right-click on Visual Studio, then select "Run As Administrator", which is fine. The problem is that I cannot right-click on any of my previously opened solutions and run VS as admin while opening that solution.

On a shortcut (and probably also some exe-files) you will get the option to "always run as administrator". Problem is, this option does not appear when looking at the properties of the DevEnv.exe file, so you need to "fake" it by going into the compatibility settings.

In essense: What I want to do is basically to always open Visual Studio "As Administrator".

So here's how:

From link 1 below:
  1. Locate devenv.exe, by right-clicking the VS icon and selecting properties, then see the link in the shortcut.
  2. Right-click devenv.exe and choose Troubleshoot compatibility
  3. In the new window click at Troubleshoot Program
  4. Check The program requires additional permissions
  5. Click "Next" until you get to a button that says "Test the application". 
  6. Click the button and VS will be launched "As Administrator". 
  7. Switch back to the dialog, press "Next".
  8. Click the top option to save the preferences.

Sources:
  1. https://superuser.com/questions/465065/no-compatibility-tab-for-devenv-exe-vs-2010-and-vs-2012-on-windows-8
Related: