【轉載】原文:https://www.cnblogs.com/zhangzhi19861216/p/3955740.html
WPF 添加Adminstrator 權限
在WPF應用開發中,需要WPF操作背景注冊的Windows Service,可是WIX打包的安裝程式不具備賦予WPF App預設管理者權限。
是以,需要我們手工在WPF項目中添加管理者權限:
1、右擊項目->Properpies->Security->Enable ClickOnce security setting,
你将看到項目屬性目錄下出現app.manifest檔案
2、修改修改節點<requestedExecutionLevel level="asInvoker" uiAccess="false" />
為
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
3、去掉Enable ClickOnce security setting選項
好了。