本文介绍了如何强制我的C#的WinForms运行的任何计算机的管理员程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何强制我的 C#的WinForms 运行任何计算机的管理员程序?和任何一种操作系统?
How to force my C# Winforms program run as administrator on any computer ? and any kind of OS ?
我需要code溶液(任何样品code将以卓越的)
I need code solution (any sample code will be excellent)
在此先感谢
推荐答案
您可以嵌入此清单到你的应用。
You can embed this manifest into your application.
<?xml version="1.0" encoding="utf-8" ?>
<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" />
<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>
</asmv1:assembly>
这篇关于如何强制我的C#的WinForms运行的任何计算机的管理员程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!