如何强制我的 .NET 应用程序以管理员身份运行? [英] How do I force my .NET application to run as administrator?
本文介绍了如何强制我的 .NET 应用程序以管理员身份运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在客户端计算机上安装我的程序后,如何强制我的程序以管理员身份在 Windows 7 上运行?
Once my program is installed on a client machine, how do I force my program to run as an administrator on Windows 7?
推荐答案
您需要修改嵌入到程序中的清单.这适用于 Visual Studio 2008 及更高版本:项目 + 添加新项目,选择应用程序清单文件".将
元素更改为:
You'll want to modify the manifest that gets embedded in the program. This works on Visual Studio 2008 and higher: Project + Add New Item, select "Application Manifest File". Change the <requestedExecutionLevel>
element to:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
用户在启动程序时会收到 UAC 提示.明智地使用;他们的耐心很快就会耗尽.
The user gets the UAC prompt when they start the program. Use wisely; their patience can wear out quickly.
这篇关于如何强制我的 .NET 应用程序以管理员身份运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文