Make visual studio solution files(sln) always executed as administrator

21,461

Solution 1

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.

Solution 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

Solution 3

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

Share:
21,461

Related videos on Youtube

mybirthname
Author by

mybirthname

Working as developer.

Updated on September 18, 2022

Comments

  • mybirthname
    mybirthname over 1 year

    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.

  • mybirthname
    mybirthname almost 8 years
    Thanks man, this worked. Only one thing for Visual Studio 2013 the correct path is C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe, not 13. You can edit that if you want.
  • Ben N
    Ben N almost 8 years
    Please include the relevant parts of the answers in yours; answers should be as self-contained as possible. Also note that checking the "run as administrator" box is reversible, and doesn't actually change the executable file.
  • tabletguy
    tabletguy almost 8 years
    The relevant part of the top voted answer is several paragraphs long, and covers the steps for Windows 7, 8, and 10. The steps are different for 7 than for 8 & 10. Several of the other answers are equally good, although perhaps not as comprehensive, but include large graphics. In this case, the best, IMO, would have been to mark this question as a near duplicate of that answer. Yes, you can easily reverse "run as admin" settings, but the point is that it's very easy to forget that you're running as admin. Just emphasizing the need for informed choice.
  • Bob Horn
    Bob Horn over 7 years
    I've had an issue where I couldn't hit my breakpoint when running VS2015 on Win10. After doing this, it started working again. Not saying it makes sense; but it worked. Thanks for this answer.
  • kimbaudi
    kimbaudi over 6 years
    +1 for printing out the possible location(s) of devenv.exe
  • user1585204
    user1585204 about 6 years
    This doesn't work any longer and I just send MS a nasty gram in no uncertain terms about it. Followed all the steps, all the way through the wizard and STILL Windows 10 won't respect the new settings. What do you need from me for clarification? Thanks!
  • heavyd
    heavyd about 6 years
    @user1585204, not sure what's wrong. I have still used this method on Windows 10 without problems. Do you by chance have multiple SKUs/versions of Visual Studio installed?