How to always launch vs.net as administrator

14

1

I need vs.net to always run as administrator.

I can't click on .sln files because it won't run as administrator.

So I have to manually click on the vs.net icon, run as administrator, and THEN open a solution file.

user3183

Posted 2009-08-16T20:12:17.010

Reputation: 3 059

The best answer I have seen to this is on: http://superuser.com/a/465407/2949

– Chris Marisic – 2012-10-31T17:06:43.567

Answers

19

You can set the shortcut to always open as administrator.

  • Right-click on the shortcut (this works even in the Start Menu)
  • Select "Properties"
  • Select the "Compatibility" tab
  • Click the "Change settings for all users" button at the bottom
  • Enter the administrative username/password
  • In the new window, select "Run this program as an administrator"
  • Click OK
  • Click OK

enter image description here

Edit: This will make Visual Studio run as an administrator for the shortcut you do this on. To have Visual Studio to always open as an administrator, follow @Vdex's instructions.

Jared Harley

Posted 2009-08-16T20:12:17.010

Reputation: 11 692

15

I assume it is done the same way as in Vista:

Got to the actual deven.exe in "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\", right click on devenv.exe, properties, compatibility and tick "run as administrator"

Vdex

Posted 2009-08-16T20:12:17.010

Reputation: 1 468

This is the solution for @homestead 's problem - this will force VS to always run as an administrator, circumventing the need to start VS as an admin first – Jared Harley – 2009-08-18T18:46:41.560

13

When you click on a .sln file, C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\vslauncher.exe is run.

If you set visual studio (devenv.exe) to always run as administrator, vslauncher won’t be able to run visual studio. Instead, you need to set just vslauncher to run as admin:

  • Right click the vslauncher.exe file, pick properties
  • pick Compatability
  • select “Run this program as an administrator”, hit OK.

A windows update will keep vslauncher from launching devenv as admin. If after setting vslauncher to admin Visual Studio still doesn't launch as admin, you need to

  • uninstall “Update for Windows 7” KB2492386.

Next, you want manually launching Visual Studio to also run as administrator. To do this,

  • find the shortcut you use to start Visual Studio (e.g. the one pinned to start menu),
  • right click on the shortcut and pick Properties
  • on the "Shortcut tab" hit Advanced
  • and select ‘Run as administrator’.

Make sure you do it via the Shortcut tab. If you do the same thing via the Compatability tab, it will set it on the underlying executable, and double clicking solution files won’t work right anymore.

David Eison

Posted 2009-08-16T20:12:17.010

Reputation: 233

1This is gold. So one should set admin for vslauncher.exe as well as devenv.exe and we are good to go. – Dennis G – 2012-12-02T17:04:31.110

4

You also need to set the following to run as an administrator:

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

chris

Posted 2009-08-16T20:12:17.010

Reputation:

2

None of these solutions offered here work for double-clicking a .sln file and having that open an instance of Visual Studio that runs as administrator. I'll give someone $50 if they can tell me how to launch an .sln w/ VS in admin mode.

EDIT:

OK - I believe I found a way around this. You have to do two things (in my case, 3, because I have VS 2008 and VS 2010 installed, and I don't EVER, EVER want either version to run without admin rights).

1) Navigate to program files location of the devenv.exe and set it to run as admin (see other post w/ screenshot re: how to do this).

2) Navigate to (I'm using WIN7 64-bit) C:\Program Files (x86)\Common Files\microsoft shared\MSEnv and find the VSLauncher.exe. Right-click > Properties... > Compatibility > Check the Run this program as Administrator box > OK

3) Navigate to any .sln > Right-click > Open with > Microsoft Visual Studio Version Selector

Performing these steps worked for me.

Wigley

Posted 2009-08-16T20:12:17.010

Reputation: 31

1

Use the same property window and set Windows Explorer (or any other file managers you are using, such as FAR) to run as an administrator.

The privileges granted to Windows Explorer will be applied to a .sln file you start by double-clicking on it.

Max Chernyshov

Posted 2009-08-16T20:12:17.010

Reputation: 11

1

the solution posted at the link below worked for me:

how-to-always-launch-vs-net-as-administrator

To sum up you need to:

  1. Make a backup copy of VSLauncher.exe
  2. Extract the manifest from VSLauncher.exe using the mt.exe tool
  3. Edit the file as outlined in the post (set it to require admin privileges)
  4. Attach the new (edited) manifest file into VSLauncher.exe using the mt.exe tool

Boris

Posted 2009-08-16T20:12:17.010

Reputation: 21

1This isn't required if the user already as admin privileges. Furthermore I have to downvote since all you did was link to an external site, which is useless, if the site goes down. – Ramhound – 2012-07-10T15:36:19.683

@Ramhound this is easily the best answer and it was Boris's first answer, looks like he has been turned off for good. The message we want to send to newbies goes along these lines: – Jeremy Thompson – 2013-03-24T23:09:04.443

Hi John Doe, it's customary in Superuser (and StackOverflow) for answers to include a summary of the contents of a link or the highlights that specifically answer the question. The goal of SE sites is to become a resource of knowledge, of answers, for years to come. With a link-only answer, the op must dig through another resource to locate an answer he/she might not be sure about. Most importantly, if your link were to ever break, your answer is useless for anyone who visits this page in the future. Consider making an edit to your answer to add more details. Good luck! – Jeremy Thompson – 2013-03-24T23:09:43.400