问题
How can I add and embed a manifest file in VB.NET, in order to add UAC support to my application?
回答1:
In VB.NET 2010, go to Project → My Project → Application→ View Windows Settings.
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:
requestedExecutionLevel level="asInvoker" uiAccess="false"
to
requestedExecutionLevel level="requireAdministrator" uiAccess="false"
回答2:
You have to add a manifest specifying the privileges you require.
Choose Project->Add New Item..., and select Application Manifest File.
A sample manifest file will be created containing a <requestedExecutionLevel>
entry and an explanation what to do with it.
This only works with Visual Studio 2008 (and probably later).
To add the manifest to 2005, this blog entry might help. It looks rather complicated.
来源:https://stackoverflow.com/questions/1431948/how-can-i-add-a-manifest-for-uac-support-to-my-vb-net-application