Vista를 위한 Application manifest
Vista에서 관리자 권한이 필요한 경우가 종종 있습니다.
예를 들어 Application이 Registry를 쓰거나 할 때죠.
몇몇 프로그램들은 Applicatioin의 바로가기를 마우스 오른쪽 클릭을 해서
나오는 Context Menu에 관리자 권한으로 실행을 클릭하라고
하는 경우가 있습니다.
그러나 UAC(User Access Control)에 약간 관심을 갖게 되면
manifest로 간단히 해결할 수 있습니다.
.NET Application일 경우
app.manifest 파일에 열어서
(혹은 [Application이름].exe.manifest 파일에서)
<trustInfo> 부분에
<security>에
원하시는 권한 레벨을 지정하시면 됩니다.
예를 들면 아래와 같습니다.
Visual Studio 2008 beta2에선 기본적으로 아래와 같이 되어 있습니다.
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" />
<requestedExecutionLevel level="requireAdministrator" />
<requestedExecutionLevel level="highestAvailable" />
If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->
<requestedExecutionLevel level="asInvoker" />
</requestedPrivileges>
</security>
</trustInfo>
</asmv1:assembly>
requestedExecutionLever을 적절히 조절하시면 레지스트리와 파일 접근에 문제가 없을 것입니다.
단, ClickOnce를 쓴다면 ClickOnce 특성상 관리자 권한을 요구하면 컴파일시 에러가 날 것입니다.
"프로그래밍 / TIP& Study" 분류의 다른 글
| [퀴즈] SQLite collate 문제 (0) | 2010/07/16 |
| [TIP] XP, Vista에서 CD/DVD롬이 보이지 않을 경우 (2) | 2009/08/05 |
| [C#] WinForm 에서 Docking 순서 변경하기 (0) | 2009/07/29 |
| [WPF] InkCanvas 사용하기 (2) | 2009/06/29 |
| [C#] Control Library 만들 때 TIP (0) | 2009/06/26 |
| [C#] 자연스럽게 Pen으로 그리기 (0) | 2009/06/23 |
| [WPF] Canvas의 Width, Height Binding (0) | 2009/06/23 |
| [C#] DateTime으로 7일 후는 어떻게? (0) | 2009/06/23 |

댓글을 달아 주세요