Always run Visual Studio as Administrator in Windows 8

Back in old Windows 7 days when we wanted to make Visual Studio always launch as administrator we only had tick the checkbox “Always run as Administrator” on Compatibility tab of the devenv.exe file properties dialog.

Now this doesn’t work anymore in Windows 8!

First problem is the absence of the Compatibility tab. Second problem is that once you managed to make the tab re-appear using a registry hack it still doesn’t work quite well when you have Visual Studio 2012 installed along with Visual Studio 2010. There is also an extension called VSCommands which promises to make it work, but it did not in my case.

Here is a simple way to make Visual Studio always launch as Administrator in Windows 8:

  1. Go to HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
  2. Add a String Valueand set its name to “C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe”. Set its value to “RUNASADMIN”.SNAGHTML86ff6b93
  3. Do the same again but use “C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe” as the name.
  4. Done! Now every time you start Visual Studio it runs as Administrator!

20 Responses to Always run Visual Studio as Administrator in Windows 8

  1. Jonathan Channon October 11, 2012 at 11:05 pm #

    I spotted the issue when I had an app writing to the registry. I put a shortcut on the task bar, right clicked the shortcut to show properties and ticked he option Run as Administrator

    • Daniel Lang October 11, 2012 at 11:16 pm #

      This approach doesn’t really work because it will only set the flag on the shortcut, not on the executable. If you want to support double-clicking of .sln files or you want to use the jump list from the taskbar, you need to set the registry key either for the VSLauncher.exe or devenv.exe file (depending upon whether you have an older version of VS installed or not).

      • Jonathan Channon October 11, 2012 at 11:26 pm #

        I only have VS2012 installed. I haven’t tried double clicking a solution file, not in my workflow. Interesting points. I also set the command prompt as a shortcut with run as administrator ticked

  2. Pure Krome October 12, 2012 at 1:07 am #

    Guys, why do you need VS2012 be run as admin?

    1. I -live- of my jump list from the taskbar (i’ve pinn’d my most important sln’s).
    2. I only double click my sln when i’ve cloned a repo and need to open the solution for the first time. After that, it’s available in my jumplist.

    I’ve never had to set anything to ‘run as admin’, etc.. or change reg keys.

    am I missing something, here?

    BTW, this is on my work, home and MBP win8 installs.

    • Daniel Lang October 12, 2012 at 1:14 am #

      Justin, you have never developed a site that needed to configure local IIS for testing? You never developed an application that listens on a TCP port? You never developed an Outlook or Office plugin that needed to register a COM component?

      Ok, then you don’t need to run VS as admin. :-)

      However, for approximately 30% of all my VS solutions I need elevated permissions, so this is why it’s more comfortable for me to always run VS as admin. Hitting F5 and only then recognizing that you’re not elevated sucks.

  3. Felix October 12, 2012 at 9:42 am #

    Thanks for the pro tip. As you said, this is great when developing software where you open TCP ports.

  4. Sean Kearon October 15, 2012 at 10:20 am #

    It’s worth noting that VS Commands for 2012 has an option to always run VS as admin.

    • Tobias October 15, 2012 at 4:47 pm #

      +1

    • Michael November 3, 2012 at 9:13 am #

      +1

  5. Mike November 13, 2012 at 5:31 pm #

    For VS2010 customers all above mentions solutions do not work at least not if you need environment setting of you user account.
    The easiest way to solve this is to Disable Policy “User Account Control: Run all administrators in Admin Approval Mode” which can be found via secpol.msc
    under Local Policies/Security Options.

    Disabling this feature let you use VS2010 as usually was possible under Win7 with disabled UAC. (ok I have to mention that I also set UAC slider to minimum)

  6. Remus December 10, 2012 at 5:18 pm #

    It took me two hours of Googling around and trying everything I cound find, until I found your tip and it finally worked! And it was so simple, no need to mess around with shortcuts and executables everywhere. I do not understand why all this about Local Policies, Security Options, VSCommands, UAC, Compatibility Tab, etc. when Regedit does it in just 5 seconds.

    By the way, my config is Win8 with VS2010 and VS2012. And I was interested in running VS2010 as admin, and this was the only tip that worked no matter how VS2010 is opened. All other tips would fail to work if VS2010 was (still) not opened in some specific way.

    Somebody asked why all this admin stuff in the first place — well, if you have a Web Application working with IIS you need admin rights for VS2010 (I don’t know about VS2012, I haven’t tested it yet). And somebody else talked about “my solution”, and how nice and easy is to set it up without Regedit — well, he doesn’t seem like a very busy guy, when he has 1 solution and not 78 like me. :)

  7. Mat January 28, 2013 at 9:18 pm #

    I had to create the “Layers” key as well, but it worked fine. Thanks! Do you imagine there will be any ACL issues down the road on that key, considering the OS hadn’t set it up already?

  8. Cassie May 28, 2013 at 6:55 pm #

    Worked perfectly, Thanks!

  9. John June 17, 2013 at 9:18 am #

    I believe that VSCommands does exactly same thing that you do with the registry.
    In addition it synchronizes options between machines so I really only have to set it up once and I’m good to go!

  10. Paul July 30, 2013 at 2:09 pm #

    use this: http://stackoverflow.com/a/12859334
    do it in less than 10 clicks!

  11. Taylor December 5, 2013 at 11:00 pm #

    This works for Visual Studio 2013 as well! I ran into this issue after installing windows 8.1 Enterprise as a VM through parallels 9 on my MBP. I was able to run visual studio as administrator, but could not open my solution files from the open file dialog within VS2013. I could open my solution files from windows explorer, but then I wouldn’t be running as administrator! So after a birds nest of forum posts(including this helpful one!), I found a way that worked for me. Make VS2013 always run as administrator through the registry addition noted in the post above (Although, I didn’t need to make a change to VSLauncher.exe), and then fully disable UAC in the registry so that you bypass the issue of explorer.exe not being able to be run as administrator.

    http://blogs.msdn.com/b/hyperyash/archive/2012/07/18/disabling-user-account-control-in-windows-8.aspx

  12. WisdomGuidedByExperience April 20, 2014 at 1:11 pm #

    Confirmed to work with Windows 8.1 Enterprise 64-bit with Update 1 running Visual Studio 2013 Premium with Update 2 RC.

    Hint: Use Windows’ built-in search capability to locate devenv.exe and then use Shift+Right-Click to “Copy As Path” to speed up the creation of the necessary registry keys.

Trackbacks/Pingbacks

  1. Eseguire Visual Studio 2012 come amministratore - February 22, 2013

    [...] http://daniellang.net/always-run-visual-studio-as-administrator-in-windows-8/ [...]

  2. No Compatibility Tab For Devenv.exe (VS 2010 And VS 2012) On Windows 8 | Click & Find Answer ! - April 21, 2013

    [...] From my blog post: http://daniellang.net/always-run-visual-studio-as-administrator-in-windows-8/ [...]

Leave a Reply