Development Tip

Visual Studio가 Windows 8에서 항상 관리자 권한으로 실행되도록 할 수 있습니까?

yourdevel 2020. 9. 27. 14:06
반응형

Visual Studio가 Windows 8에서 항상 관리자 권한으로 실행되도록 할 수 있습니까?


Windows 7에서는 프로그램 호환성 설정으로 이동하여 항상 관리자 권한으로 실행되도록 선택할 수 있습니다. Windows 8에 유사한 옵션이 있습니까?

나는 항상 내 컴퓨터에서 UAC를 비활성화했으며 Windows 8 업그레이드 후에도 동일한 작업을 수행했습니다. off옵션 이없고 알림 만 끄는 것으로 밝혀졌습니다 .

즉, 관리자 그룹에 속해 있어도 관리자로 실행되는 것은 없습니다. 디버깅을 시도 할 때 콘솔 \ Visual Studio를 계속 닫았다가 다시 열어야합니다 (가 아닌 프로세스에 연결 F5). 매우 실망 스럽습니다.

관리자 권한으로 열기 위해 추가 단계를 수행하거나 처음으로 디버그 할 때 닫았다가 다시 열도록 지시해야한다는 점이 정말 짜증납니다.


Windows 8 및 10에서는 마우스 오른쪽 버튼을 클릭 devenv.exe하고 "호환성 문제 해결"을 선택 해야합니다 .

  1. "프로그램 문제 해결"을 선택합니다.
  2. "프로그램에 추가 권한이 필요합니다"를 선택하십시오.
  3. "다음"을 클릭하십시오.
  4. "프로그램 테스트 ..."를 클릭합니다.
  5. 프로그램이 시작될 때까지 기다립니다.
  6. "다음"을 클릭하십시오.
  7. "예,이 프로그램에 대한 설정을 저장합니다"를 선택합니다.
  8. "닫기"를 클릭하십시오.

Visual Studio를 열 때 devenv.sln에 변경 사항을 저장하라는 메시지가 표시되면 다음 답변을 참조하여 비활성화하십시오.

Visual Studio devenv 솔루션 저장 대화 상자 비활성화


마음이 바뀌고 "관리자 권한으로 실행"호환성 설정을 취소하려면 여기에있는 대답을 참조하십시오. Visual Studio 2015에서 인식되지 않는 Guid 형식을 수정하는 방법


Super User를 살펴본 후 시작 화면의 바로 가기를 사용하여이를 수행하는 방법을 설명하는 이 질문발견 했습니다 . 마찬가지로 Visual Studio가 작업 표시 줄에 고정 된 경우에도 동일한 작업을 수행 할 수 있습니다. 어느 위치에서나 :

  1. Visual Studio 아이콘을 마우스 오른쪽 버튼으로 클릭합니다.
  2. 이동 Properties
  3. 세 이하 Shortcut tab선택Advanced
  4. 검사 Run as administrator

관리자 모드에서 기본 작업 설정

Windows 7과 달리 변경 한 바로 가기에서 응용 프로그램을 시작하는 경우에만 작동합니다. 두 Visual Studio 바로 가기를 모두 업데이트 한 후 탐색기에서 솔루션 파일을 열 때도 작동하는 것 같습니다.

Update Warning: It looks like one of the major flaws in running Visual Studio with elevated permissions is since Explorer isn't running with them as well you can't drag and drop files into Visual Studio for editing. You need to open them through the file open dialog. Nor can you double click any file associated to Visual Studio and have it open in Visual Studio (aside from solutions it seems) because you'll get an error message saying There was a problem sending the command to the program. Once I uncheck to always start with elevated permissions (using VSCommands) then I'm able to open files directly and drop them into an open instance of Visual Studio.

Update For The Daring: 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.


NOTE in recent VS versions (2015+) it seems this extension no longer exists/has this feature.


You can also download VSCommands for VS2012 by Squared Infinity which has a feature to change it to run as admin (as well as some other cool bits and pieces)

여기에 이미지 설명 입력

Update

One can install the commands from the Visual Studio menu bar using Tools->Extensions and Updates selecting Online and searching for vscommands where then one selects VSCommands for Visual Studio 20XX depending on whether using 2012 or 2013 (or greater going forward) and download and install.


  1. On Windows 8 Start Menu select All Apps
  2. Right click on Visual Studio 2010 Icon
  3. Select Open File Location
  4. Right click on Visual Studio 2010 shortcut icon
  5. Click Advanced button
  6. Check the Run as Administrator checkbox
  7. Click OK

This is a copy of my answer to a similar post on SuperUser:

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 2017

C:\Program Files (x86)\Microsoft Visual Studio\2017\[VS SKU]\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.

VSCommands didn't work for me and caused a problem when I installed Visual Studio 2010 aside of Visual Studio 2012.

After some experimentations I found the trick:

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 should solve your issue. I've also blogged about that.


If you using Total Commander as I do, you should do the same for Total Commander to be run as admin always. Then you will be able to open sql file on double click in same SQL Server management instance, or to open any Visual Studio file on double click and not have multiple instances open.

This Troubleshoot program adds registry value to HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers for any program, so if you like to write it directly you can.


I know this is a little late, but I just figured out how to do this by modifying (read, "hacking") the manifest of the devenv.exe file. I should have come here first because the stated solutions seem a little easier, and probably more supported by Microsoft. :)

Here's how I did it:

  1. Create a project in VS called "Exe Manifests". (I think any version will work, but I used 2013 Pro. Also, it doesn't really matter what you name it.)
  2. "Add existing item" to the project, browse to the Visual Studio exe, and click Okay. In my case, it was "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe".
  3. Double-click on the "devenv.exe" file that should now be listed as a file in your project. It should bring up the exe in a resource editor.
  4. Expand the "RT_MANIFEST" node, then double-click on "1" under that. This will open up the executable's manifest in the binary editor.
  5. Find the requestedExecutionLevel tag and replace "asInvoker" with "requireAdministrator". A la: <requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel>
  6. Save the file.

You've just saved the copy of the executable that was added to your project. Now you need to back up the original and copy your modified exe to your installation directory.

As I said, this is probably not the right way to do it, but it seems to work. If anyone knows of any negative fallout or requisite wrist-slapping that needs to happen, please chime in!


I found a simple way to do this on EightForums (Option 8), create a string value under HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers. Set the name to the path to the program and the value to ~RUNASDMIN. Next time you open the program it will open as an administrator

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
    "C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\devenv.exe"="~RUNASADMIN"

Just find the program in Program Files directory (or in other location). Right click on the EXE file, on the second tab at the bottom check the checkbox of forcing running that program with administration privileges. From now all shortcuts of the exe file will be fired with administration privileges :)


Right-clicking on visual studio and select run as administrator at every time you intend to open it.

Also, you can check the compatibility troubleshooting

  • Right Click on Visual Studio > Select Troubleshoot compatibility.
  • Select Troubleshoot Program.
  • Check The program requires additional permissions.
  • Click on Test the program.
  • Wait for a moment till the program launch.Click Next.
  • Select Yes, save these settings for this program.
  • Wait for resolving the issue.
  • Make sure the final status is fixed.Click Close.

세부 단계 링크를 확인하십시오 .


프로젝트의 애플리케이션 매니페스트가 관리를 지정하면 Visual Studio가 자동으로 상승 requestedExecutionLevel하므로이를 편집하기 만하면됩니다. Visual Studio는이를 감지하고 필요할 때 관리자 권한으로 다시 시작합니다.

참고 URL : https://stackoverflow.com/questions/12257110/can-you-force-visual-studio-to-always-run-as-an-administrator-in-windows-8

반응형