[Tip] Run Visual Studio as Administrator

Probably you already knew this trick to run apps in Windows 10 as Administrator. If not, I hope this tip can help you.

Sometimes, you need to execute Visual Studio as Administrator always, for example if you are deploying and debugging your application in your Local IIS. To execute VS as Admin there are several ways.

1) Using Sub-menus:
If you go to the item in Windows menu and click on right, you will see menu "More", where you can run VS as administrator.



2) Using shortcuts:
Previous method is slow, so If you don't want to do this each time you open VS, you can create a shortcut in your Desktop and execute it as Administrator. To do this, press right click on the shortcut, click on Advanced and select Run as administrator.



3) Always as Administrator:
Method 2 is much better than 1, but you always have to open VS by using your modified shortcut. So for example, you can not open directly a file .sln with Admin rights. But don't worry, there is a method to execute VS always as Administrator.
In the properties of the previous shortcut, go to "Open File Location". Over devenv.exe press right click and go to Troubleshoot compatibility.


Then choose Troubleshoot program and select "The program requires additional permissions".
Finally, save these settings for this program and you won't have to care anymore about open VS with sub menus or shortcuts to run it as Administrator. You can use the same method for PowerShell or whatever program you want.


I hope you find this tip useful.

Happy coding.







Comments

Popular posts from this blog

Building Micro-Frontends with Single-Spa

AWS assuming role + MFA with pulumi (and other applications)

Managing snapshots for Amazon ElasticSearch with Dotnet Core Lambdas