Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I require the file

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

to automatically run as administrator, otherwise I cannot open *.sln files from Windows Explorer.

I had addressed this problem previously by checking the "Run as Administrator" check-box in the file property's compatibility tab, however this no longer works. Opening VSLauncher.exe directly does nothing, but right clicking it and selecting "Run as Administrator" does! All my devenv.exe are set to run as admin and they work as expected.

It's worth noting that this broke after some updates, possibly Visual Studio 2010 Service Pack 1.

share|improve this question
1  
Is "Run as Administrator" set for all users or just you? –  wullxz May 17 '11 at 6:47
    
I think, why can't you open .sln files without admin permissions ist the more interesting question. Maybe this can be solved more easy. –  Michael K May 17 '11 at 7:06
    
@Michael - Normally I would agree, but in this case, it is Visual Studio he is talking about. There are many cases where VS has to be opened with admin privileges during development. –  Jared Harley May 17 '11 at 7:13
    
This has been discussed before, but not specifically dealing with VS2010 SP1. –  Jared Harley May 17 '11 at 7:14
    
This behavior seems kinda strange to me, I'm using vs2010 on win7 x64 pro since it was released and I don't have any problem like this. To work around the problem, is there a way to start vs as admin via batch file? –  Michael K May 17 '11 at 7:16

1 Answer 1

up vote 3 down vote accepted
+50

From Getting Visual Studio 2010 SP1 to run elevated when launching .sln files :

After some research, I found that the reason for Windows ignoring my compatibility setting was that VSLauncher.exe now had a manifest embedded, which contained the following fragment:

<requestedPrivileges>
   <requestedExecutionLevel level="asInvoker" uiAccess="false">
   </requestedExecutionLevel>
</requestedPrivileges>

So, VSLauncher.exe now specified that it always wanted to be run at the same execution level as its invoker. And, since of course the program must know better than the user, this caused Windows to ignore my own execution level setting.

And now, to the solution. Since Windows wouldn’t let me override what the program said it wanted, I needed to override what the program said it wanted.

To do that, I used the Manifest Tool that comes with the Windows SDK (and thus with Visual Studio):

mt -inputresource:"VSLauncher.exe" -out:VSLauncher.exe.manifest

This command extracted the manifest from VSLauncher.exe into a file called VSLauncher.exe.manifest. I then edited the manifest to request the desired execution level:

<requestedPrivileges>
   <requestedExecutionLevel level="requireAdministrator" uiAccess="false">
   </requestedExecutionLevel>
</requestedPrivileges>

Then, I could write back the manifest:

mt -outputresource:VSLauncher.exe -manifest VSLauncher.exe.manifest

With the desired result.

One note of caution: Please make a backup copy of VSLauncher.exe before manipulating the manifest.
And perform at your own risk.

share|improve this answer
    
IT WORKS! HAHAHAHAHA. Thanks Harry. –  Evil Pigeon May 27 '11 at 6:34
    
It still doesn't work for me. –  Matthew Scouten Aug 15 '11 at 20:06
    
opening from the recents list still doesn't open VS in admin mode. (right click VS pinned icon and pick a recent project) –  m4tt1mus Sep 15 '11 at 22:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.