windows 如何向我的 VB.NET 应用程序添加清单(用于 UAC 支持)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1431948/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I add a manifest (for UAC support) to my VB.NET application?
提问by Sreejith
How can I add and embed a manifest file in VB.NET, in order to add UAC support to my application?
如何在 VB.NET 中添加和嵌入清单文件,以便为我的应用程序添加 UAC 支持?
回答by Sreejith
In VB.NET 2010, go to Project → My Project → Application→ View Windows Settings.
在 VB.NET 2010 中,转到项目 → 我的项目 → 应用程序 → 查看 Windows 设置。
You'll see the default manifest. From here, you can change it as you desire.
您将看到默认清单。从这里,您可以根据需要进行更改。
For example, in this case, to require UAC elevation when the application launches, change:
例如,在这种情况下,要在应用程序启动时要求 UAC 提升,请更改:
requestedExecutionLevel level="asInvoker" uiAccess="false"
to
到
requestedExecutionLevel level="requireAdministrator" uiAccess="false"
回答by Timbo
You have to add a manifest specifying the privileges you require.
您必须添加一个清单,指定您需要的权限。
Choose Project->Add New Item..., and select Application Manifest File.
选择Project->Add New Item...,然后选择Application Manifest File。
A sample manifest file will be created containing a <requestedExecutionLevel>
entry and an explanation what to do with it.
将创建一个示例清单文件,其中包含一个<requestedExecutionLevel>
条目和如何处理它的说明。
This only works with Visual Studio 2008 (and probably later).
这仅适用于 Visual Studio 2008(以及可能更高版本)。
To add the manifest to 2005, this blog entrymight help. It looks rather complicated.
要将清单添加到 2005,此博客条目可能会有所帮助。看起来比较复杂。