How to set the C # program to run as administrator in Windows 7 Vista

Source: Internet
Author: User

This issue mainly targets permissions required for some operations:

For example, modify the registry, modify the Service Startup type, and so on. If no administrator permission is granted, these operations may report errors or be invalid. How to make yourProgramWhat if I run Windows 7 Vista as an administrator? You only need to modify the app. manifest. App. mainfest of the project property. By default, the app. manifest. App. mainfest does not exist. You can perform the following steps to generate and modify it:

1. Select your project, find properties, and click the properties page.

2. Select enable clickonce security settings.

Now, the app. manifest file is automatically generated in the properties directory. open the file and change the value of requestedexecutionlevel of the trustinfo/security/requestedprivileges node to requireadministrator. As follows:
<Requestedprivileges xmlns = "urn: Schemas-Microsoft-com: ASM. V3">
<Requestedexecutionlevel level ="Requireadministrator"UIAccess =" false"
/>
</Requestedprivileges>

3. Restart compilation.

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.