# Always start Visual Studio as an Administrator on Windows 8

Whenever I start Visual Studio 2012 in Windows 8 it always needs Administrator permissions to access IIS meta data and debug local web applications on IIS.

If I turn UAC off, I cannot launch the Windows 8 simulator!

Does anyone know how I can get it to stop with all this security nonsense and just let me get on with my work?

-
Using unreleased software on an unreleased platform...you are probably going to have to put up with some nonsense. –  Adam King Aug 17 '12 at 15:49
–  Boomerangertanger Aug 17 '12 at 15:50
It's on MSDN now. –  Boomerangertanger Aug 17 '12 at 15:51
Have you tried creating a shortcut and assign run as user to that shortcut? –  tumchaaditya Aug 17 '12 at 15:58
The default is to run not as an admin. –  Boomerangertanger Aug 17 '12 at 16:39

1. Right click on the "Metro" Icon for Visual Studio 2012

2. Click "Open File Location". It will put you into the classic windows desktop with the shortcut for Visual Studio.

3. Right-Click on that shortcut and go to "Properties"

5. Check "Run as Administrator" and click OK.

From now on, it will always launch as Administrator with elevated privileges.

You will need to do this for every shortcut you have to Visual Studio.

I.e., if you also have pinned Visual Studio to the task bar.

1. Right-Click the icon.

2. Right-Click 'Visual Studio 2012'

3. Then carry on from step 3 above.

-
Do you also know of a way to turn on 'Run as Admin' by default? On Windows 8 they seem to have made it to run as User only, sensible for end users, but for devs, we get a useless 'permission needed' dialog all the time you can just click through anyway. –  simbolo Aug 25 '12 at 1:21
I still don't know of a way of making the 'Run As Admin' preference stick when launching a pinned or recent solution from the taskbar. –  simbolo Aug 25 '12 at 1:28
This is not an effective answer. For example if you open Visual Studio by opening a project/solution instead of via a devenv.exe shortcut it won't be running as elevated/Administrator. –  nathanchere Aug 30 '12 at 0:41
FerretallicA's answer is the right one. –  uosɐſ Jan 24 '13 at 23:16
@uosɐſ I agree - this isn't the answer as it only works for the program itself not launching .sln files that need VS2012 directly. Check FerretallicA answer –  BritishDeveloper Mar 2 '13 at 10:59

The Only way I'm aware of which ensures it will always open as Administrator (including when you open from file associations, jump list etc) is:

1. Locate the devenv.exe file in Explorer eg mine is in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\

2. Right-click devenv.exe and choose "Troubleshoot compatibility"

3. Select "Troubleshoot program"

4. Select "This program requires additional permissions"

You'll need to let it launch VS before it lets you click Next, but then you're done.

EXTREMELY annoying that you can't just do this through the normal properties dialog any more. It's like Microsoft are going out of their way to ensure Windows 8 alienates as many people as possible...

-
This Troubleshoot Compatibility is the way to go - takes care of all your shortcuts and pinned items at once! This should be the marked answer. –  uosɐſ Jan 24 '13 at 23:14

Had the same issue, teammate suggested solution that worked for me is to install VSCommands for Visual Studio 2012, then open VSCommands config, set IDE Enhancements - General - Always start Visual Studio with elevated permissions.

-

I posted about this on Stack Overflow before finding this question and then tried everything the other answers here suggested. I started running into some issues right away though.

When running VS2012 with elevated permissions I was no longer able to drag & drop files into it from Explorer which I assume is because Explorer isn't running with elevated permissions.

Then after I used VSCommands to always run Visual Studio with elevated permissions I was no longer able to open files associated with Visual Studio, aside from solution files, by double clicking them in Explorer. Visual Studio would open but then I'd get an error saying There was a problem sending the command to the program. and they wouldn't open.

This left me having to use the open file dialog if I wanted to open any non solution/project file.

Despite there being no UI to turn off UAC like in the past, that I saw at least, you can still do so through the registry. The key to edit is:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
EnableLUA - DWORD 1-Enabled, 0-Disabled


After changing this Windows will prompt you to restart. Once restarted you'll be back to everything running with admin permissions if you're an admin. The issues I reported above are now gone as well.

-
Thanks for such a detailed answer. Unfortunately, the metro apps, like SkyDrive will not operate without UAC turned on. So I'm afraid this is not a viable solution. The only way is to set "Run as admin" in devenv.exe's compatibility settings. thanks –  Boomerangertanger Sep 6 '12 at 7:47
I'm running version 16.4.6010.0727 of SkyDrive and it's syncing my files just fine. I don't have overlay icons anymore when in the SkyDrive folder but the syncing still works. As for the metro apps...I'm staying clear of them. Not only do I not like that part of win8 but it just makes life more difficult for me, as you can see with this UAC stuff. By the looks of it though that seems to be their goal with win8 & vs2012. –  Brian Surowiec Sep 6 '12 at 8:07
I'm not sure why you don't like metro, it's just a load of icons and apps, much like Windows 1.0 to Windows 7, except the icons are squarer and the apps are full screen. I don't know why your life is harder, given that when you press start and type something, the list pops up and you hit enter like normal. –  Boomerangertanger Sep 6 '12 at 11:52

Go to HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers and add an entry with the name C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe and the value RUNASADMIN. This will make VS launch as admin.

-
For some reason this didn't work for me, but adding the entry in HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers instead did the trick. –  Piotr Szmyd Sep 25 '13 at 17:44

## Option 1 - Set VSLauncher.exe and DevEnv.exe to always run as admin

To have Visual Studio always run as admin when opening any .sln file:

1. Navigate to C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe.
2. Right-click on VSLauncher.exe and choose Troubleshoot compatibility.
3. Choose Troubleshoot program.
4. Check off The program requires additional permissions and hit Next.
5. Click the Test the program... button to launch VS.
6. Click Next, then hit Yes, save these settings for this program, and then the close buton.

To have Visual Studio always run as an admin when just opening visual studio directly, do the same thing to the DevEnv.exe file(s). These file are located at:

### Visual Studio 2010

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe

### Visual Studio 2012

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe

### Visual Studio 2013

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe

## Option 2 - Use VSCommands extension for Visual Studio

Install the free VSCommands extension for Visual Studio (it's in the Visual Studio Extensions Gallery) and then configure it to always have Visual Studio start with admin privileges by going to Tools -> VSCommands -> Options -> IDE Enhancements -> General and check off Always start Visual Studio with elevated permissions and click the Save button.

## My Opinion

I prefer Option 2 because:

• it also allows you to easily turn off this functionality.
• VSCommands comes with lots of other great features so I always have it installed anyways.
• it's just easier to do than option 1.
-

On my Win8 machine with VS Express 2013 the problem is occuring when I store my project in My Documents. I've seen this on Win7 machines with older VS as well. When i create a new project / move it to a different location (like C:/Programming/) it works as it should!

-