我有一个 wpf 应用程序,我希望它需要并获得提升的权限。我怎样才能做到这一点? 如果使用 vs2013,我正在运行 .net 4.5,如果有区别的话。
最佳答案
您需要为您的应用创建 list 文件,例如myapp.exe.manifest
它需要包含这样的部分...
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" />
</requestedPrivileges>
</security>
</trustInfo>
当然,当用户运行您的应用时,它会显示通常的信任对话框并征求他们的同意。
关于c# - 如何以提升的权限运行 wpf 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22808953/