Visual Studio in the context of an administrator account

Error

 

To access local IIS Web sites, you must run Visual Studio in the context of an administrator account.

 

SolFileOpenError

 

When we will get this error

 

If the solution file contains any websites that are hosted on IIS web server, this error will come.

 

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 that:

 

 

Solution

 

The solution is to go and update VSLauncher.exe so that it always runs as administrator. 

 

You'll find VSLauncher here:

 

C:\Program Files (x86)\Common Files\microsoft shared\MSEnv

 

VSLauncher

 

 

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.

 

VSLauncherCompatibility

 

 

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.