Open Visual Studio Files As Administrator

Date Published: 03 March 2010

Open Visual Studio Files As Administrator

Working with IIS as your web server, or working with Azure projects, are two examples of situations in which Visual Studio (2008+) needs to be running as Administrator (on Windows Vista or Windows 7). If you don't run it as such, you may be faced with a dialog like this one (for Azure):

azure tools for visual studio

Now of course if you have Visual Studio pinned to your taskbar or start menu, you can launch it as admin by right-clicking and selecting Run As Administrator, as Jeff Blankenburg shows here. That's great for one-off things, but in my scenario I really want to be able to double-click on a .sln file and have it open with Visual Studio as an administrator:

cloud project solution

The solution as suggested by http://twitter.com/JeremySkinneris to go and update VSLauncher.exe so that it always runs as administrator. You'll find VSLauncher here:

C:Program Files (x86)Common Filesmicrosoft sharedMSEnv

Right click on it, select Properties, and then the Compatibility tab. From here you can check the box for Run this program as an administrator:

vslauncher properties

With that done, you can now go right into your project structure in Windows Explorer and open whichever solution or project files you want, and they will open in an Administrator privileged instance of Visual Studio, with the elevated privileges Azure and IIS require.

Steve Smith

About Ardalis

Software Architect

Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.