简体   繁体   中英

Execute Setup with admin rights

I have a windows forms app developed in c# and have created a setup file for it. .Net Framework used is 3.0.

Now, setup should force for admin rights for installation and then proceed else not.

I found articles on creating manifest file which works fine but when program is launched after installation it again asks for admin rights which is not i want.

And this prompt should also work on Windows XP SP 1 and above OS.

To prompt Installer to invoke the UAC prompt to the user you can do the following:

  • Right click your Setup Project > View > Launch Conditions.
  • Right click Launch Conditions > Add a new Condition in your Launch Conditions.
  • Right click the Condition, choose Properties Window.
  • Set Condition to AdminUser . (You can also try setting Privileged property)
  • Build and install

OR

Edit your .vdproj, change requiresElevation attribute to true

"MsiBootstrapper"
{

    "RequiresElevation" = "11:TRUE"
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM