In vs.net (C #), set the default "Run as administrator" method when the program is started.

Source: Internet
Author: User

In vs2008 and vs2010, the method is relatively simple:
<1>. In the project, click "new item", select "Application List" (. manifest), and name the file by yourself,
<2> open the created configuration file with the extension. manifest and check the code. We can see the UAC option with annotations. What we need to change is the content of this node:
<Requestedexecutionlevel level = "asinvoker" UIAccess = "false"/> change asinvoker to requireadministrator
<3> open the project properties and select the configuration file created for you from "Application-resource ".
<4>. Generate one more time.

It is troublesome in vs2005 and has not been tested. Copy the online solution as follows:
<1> check whether app exists in properties. manifest file; if not, right-click the project and select "properties" from the menu. The page appears. On the "Security" tab, select "enable clickonce Security Settings" on the page, under properties, an app is automatically generated. manifest file. Open the app. manifest file and add
<Requestedprivileges>
<Requestedexecutionlevel level = "requireadministrator" cess = "false"/>
</Requestedprivileges>,
Re-compile,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.