10

I recently upgraded to Windows 10 and Visual Studio 2019.

Prior to the upgrade, Visual Studio 2017 would always run as Administrator. I did not think much of this, but now that it is gone it is causing me problems.

The primary one is that it will not load my projects that use my local instance of IIS.

I usually launch Visual Studio from my start bar. Right now this goes like this:

  1. Right click on the icon on the start bar and select my solution.
  2. It loads and then I realize that the main project did not load.
  3. Close visual studio, open as admin
  4. Pick my solution and then it loads.

I would really like to only have to do #1 above. Is there someway I can edit the shortcut on the start bar to have it always launch as Administrator?

Vaccano
  • 78,325
  • 149
  • 468
  • 850
  • Right Click on the Startbar icon, right click again on the Visual Studio menu, choose Properties, then Advanced, and here the Run as Administrator checkbox is waiting for a mark – Steve Aug 28 '19 at 18:28
  • ctrl-shift-click will launch in admin mode. Also works from the search box. – jessehouwing Aug 28 '19 at 18:42
  • @Steve - I did not know about that setting! But unfortunately it is already checked. I tried again after I saw it, and it still only loads correctly when I right click on the icon and then select "run as administrator". Sounds like something may be wrong with my install.... – Vaccano Aug 28 '19 at 18:49
  • 1
    @Steve - Must have something to do with selecting the project from the list of options. If I just run (without selecting a project), then it is administrator. – Vaccano Aug 28 '19 at 18:52
  • Just to offer a troubleshooting step, try deleting the existing taskbar shortcut and recreate it, and then set it to always run as admin, and then see if it works as expected. – egnomerator Aug 28 '19 at 18:53
  • I get same behavior as @Steve – egnomerator Aug 28 '19 at 18:53
  • Does this answer your question? [VS2017 / VS 2019 Run As Admin from Recent solutions list](https://stackoverflow.com/questions/42723232/vs2017-vs-2019-run-as-admin-from-recent-solutions-list) – Super Jade Feb 25 '21 at 19:26

1 Answers1

36

Turns out that Visual Studio uses different permissions when you click on the list of shortcut options it offers in the start menu. (IE to load a recent solution directly.)

Selecting the Properties->Advanced->"Run as Administrator" did not cause these to run as administrator.

But this did it:

  • Find devenv.exe (Visual Studio's executable)
  • Right Click on it and select "Troubleshoot Compatibility".
  • On the Program Compatibility Troubleshooter window, click on Troubleshoot Program
  • Check that the program requires additional permissions and click Next
  • On the next window, click on Test the program… and VS will open as administrator
  • Click next and then click on Yes, save these settings for this program

Now Visual Studio will ALWAYS run as administrator.

(Taken from: https://ppolyzos.com/2017/08/08/always-run-visual-studio-as-administrator/)

Vaccano
  • 78,325
  • 149
  • 468
  • 850