ObservableDeveloper - Leonid Sorokin's Blog

.NET, Silverlight, ASP.NET, Web Services, SQL Server, Cloud Computing, and much more...

About the author

I am a .NET Software Developer, Consultant, and Trainer from Toronto, Canada specializing in web development with Rich Internet Applications on the Microsoft development tool chain.

My Photo

Microsoft Certified Professional Developer

How to run Visual Studio as administrator on Vista (with UAC)

I just ran into a strange problem on Windows Vista that touches upon Visual Studio 2008 and IIS 7.

I created a WCF Service Application project and in the properties I set it up to use the Local IIS Web Server (i.e. not Cassini). So far so good.

However, when I opened my solution file later on, Visual Studio complained that I was not running it under an Administrator account, and failed to load that project.

It turns out that if UAC (User Access Control) is enabled, Visual Studio does not run under an admin account automatically, and as such I had three choices:

  • Disable UAC on Windows Vista (I know it’s annoying but it does do a good job at protecting your machine)
  • Run Visual Studio as Administrator explicitly (really annoying…what if I forget? Besides, I usually like to open my .sln files by double-clicking via Windows Explorer)
  • Setup Visual Studio to run as administrator automatically (I think this is the best option)
    • Go to C:\Program Files\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe and C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe (could be different depending on your version), right-click on each one, and go to Properties. Under the Compatibility tab, make sure to choose Run as Administrator. Now when you run Visual Studio, it will automatically prompt you with the UAC, which is really what you want. Of course, this approach will work with any other program and not just Visual Studio. If you encounter any further issues, read http://www.pluralsight.com/community/blogs/matt/archive/2007/05/21/47446.aspx.

Now back to work…


Permalink | Comments (0) | Post RSSRSS comment feed