Always start Visual Studio as an Administrator on Windows 8

29,569

Solution 1

  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"

  4. Click "Advanced"

  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.

Solution 2

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...

Solution 3

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.

Solution 4

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.

Solution 5

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

Visual Studio 2015

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

Visual Studio 2019

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\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.

Note: VSCommands is not currently available for VS 2015, but their site says they are working on updating it to support VS 2015.

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.
Share:
29,569

Related videos on Youtube

Boomerangertanger
Author by

Boomerangertanger

Updated on September 18, 2022

Comments

  • Boomerangertanger
    Boomerangertanger over 1 year

    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?

    • Adam King
      Adam King almost 12 years
      Using unreleased software on an unreleased platform...you are probably going to have to put up with some nonsense.
    • Boomerangertanger
      Boomerangertanger almost 12 years
      It's on MSDN now.
    • tumchaaditya
      tumchaaditya almost 12 years
      Have you tried creating a shortcut and assign run as user to that shortcut?
    • Boomerangertanger
      Boomerangertanger almost 12 years
      Unfortunately, I need it to work when clicking on associated file types.
    • Ramhound
      Ramhound almost 12 years
      The default behavior of Visual Studio is to always run as an administrator. If your user account does not have administrator priviliages, you need to escalate your user account, by using the "run as administrator"
    • Boomerangertanger
      Boomerangertanger almost 12 years
      The default is to run not as an admin.
  • Admin
    Admin over 11 years
    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.
  • Admin
    Admin over 11 years
    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.
  • nathanchere
    nathanchere over 11 years
    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.
  • Brian Surowiec
    Brian Surowiec over 11 years
    @simbolo before using VSCommands I used the above solution on both the start screen shortcut and my pinned taskbar shortcut. When both of those were set to run as admin then double clicking my solutions/projects in Explorer would open in an admin level Visual Studio. I'm not sure if there's anything else I changed to make that happen but it's worth a try. If that doesn't work then see my answer for my final solution to all this.
  • Boomerangertanger
    Boomerangertanger over 11 years
    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
  • Brian Surowiec
    Brian Surowiec over 11 years
    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.
  • Boomerangertanger
    Boomerangertanger over 11 years
    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.
  • Jason Kleban
    Jason Kleban over 11 years
    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.
  • Jason Kleban
    Jason Kleban over 11 years
    FerretallicA's answer is the right one.
  • BritishDeveloper
    BritishDeveloper about 11 years
    @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
  • Piotr Szmyd
    Piotr Szmyd over 10 years
    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.
  • Naomi
    Naomi about 8 years
    vscommands.squaredinfinity.com doesn't seem to be available for VS 2015.
  • deadlydog
    deadlydog about 8 years
    @Naomi Yeah, I Noted that in my post. They say they are working on it though, so hopefully they will have a VS 2015 compatible version later this year.
  • Naomi
    Naomi about 8 years
    BTW, I tried the first option yesterday for the launcher in my Windows 10 and it didn't work. VS still starts normally. I also can not change shortcut Advanced properties - they are disabled for me
  • deadlydog
    deadlydog about 8 years
    @Naomi hmmm, are you logged in as an admin on your computer?