24

I have solutions in Visual Studio which are configured to use IIS or to update SQL server database. If the solution is not run as administrator the project which is configured with IIS doesn't loads, because I don't have permissions. So my workaround is to run the Visual Studio 2013/2015 always as administrator(even I'm in the admin account) and open the project from there. In this case everything is working.

The visual studio solution files doesn't have the possibility to be ran as administrator (also the advanced option in the properties of the shortcut has run as administrator not enabled and not editable). How I can achieve that, I search in the web that I can add registry, but I try one or two of the suggestions and nothing worked.

How I can achieve to open solution files always as administrator on both vs 2013/2015.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell\runas\Command] @="\"C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe\" \"%1\""

This is what I had tried, without success.

3 Answers3

50

Locate the devenv.exe executable on your hard drive. You can usually find it in the following places:

Visual Studio 2013
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe

Visual Studio 2015
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe

Visual Studio 2017
C:\Program Files (x86)\Microsoft Visual Studio\2017\<SKU_TYPE>\Common7\IDE\devenv.exe

Right click on the devenv.exe executable in Windows Explorer and select "Troubleshoot compatibility" and then select "Troubleshoot program." From the next screen select "The program requires additional permissions" and then complete the wizard.

This will change your settings so that any time you try to run Visual Studio you will be running elevated.

heavyd
  • 65,321
2

StackExchange has already answered this and is more comprehensive, covering Windows 7, 8, 10 as well as modifying jump lists. In general most people won't want to always run as admin, so permanently modifying the devenv.exe doesn't seem like a good general solution: https://stackoverflow.com/questions/9654833/how-to-run-visual-studio-as-administrator-by-default

2

In Windows 10 do the following steps: - Download and install the 'Everything' application that locates files and folders by name instantly. - Find the 'devenv.exe' and locate it.

Everything

  • Right-click on 'devenv.exe' and select "Troubleshoot compatibility". Then select "Troubleshoot program". Then check "The program requires additional permissions". Then test the setting and save setting in next page.

Troubleshoot compatibility

Troubleshoot program

The program requires additional permissions

Run As admin