It can be frustrating when you’re working with ASP.NET web apps that are binded locally to IIS and when opening Visual Studio your web project fails to load. The less experienced developer could end up wasting time trying to figure out what’s going on and even investigate code only to feel embarrassed when you discover that is simply due to Visual Studio not being opened in Administrator Mode.
Sure, you can right click your Visual Studio shortcut and select “Run as Administrator” but if you’re working on many projects and have shortcuts to the .SLN files you can’t do this. What you need is to set the Visual Studio executable to always run as administrator. It’s not obvious how to achieve this in windows 10 so I’ve put together this simple tutorial so once and for all you can set Visual Studio to only start in Administrator mode.
To begin you need to find the Visual Studio executable, the .EXE that opens Visual Studio. For personal projects I’m using Visual Studio Community Edition, but the file location will be very similar whatever version you are using.
Path - C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE
1 - Open an explorer window and paste this path in.
2 - Now search for “devenv.exe” to find the .exe then right click the devenv.exe and select “troubleshoot compatibility”
3 - Click Troubleshoot program
4 - Ensure you tick “the program requires additional permissions”
5 - Click Test the program. This will open Visual Studio. You should see the “(Administrator)” in the top left. Go back to the dialog and click next
6 - Now select “Yes, save these settings for this program”
And that’s it, now every time you open Visual Studio regardless of if you open a solution file it will always open in Administrator mode.