Maui开发中Windows应用开启管理员权限
首先打开文件夹 Platforms/Windows
在文件 app.manifest
中添加
<trustInfo xmlns='urn:schemas-microsoft-com:asm.v2'>
<security>
<requestedPrivileges xmlns='urn:schemas-microsoft-com:asm.v3'>
<requestedExecutionLevel level='requireAdministrator' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
然后再文件 Package.appxmanifest
(右键->查看代码) 中添加
<Capabilities>
<rescap:Capability Name="runFullTrust" />
<rescap:Capability Name="allowElevation" />
</Capabilities>
转载请保留原文链接: https://zodream.cn/blog/id/235.html