Run the WinForm program as an administrator

Time:2020-11-21

1. In Visual Studio – Solution Explorer – right click the project name – property, find the “security” option, and check “enable ClickOnce security settings”:

 

2. At this point, there will be one more under the project“ app.manifest ”The file,

Select it and find the code snippet,

Replace it with:,


3. After correction, do not rush to recompile and build, and open the “properties security” interface again,

 

Remove the check in front of “enable ClickOnce security settings” before compiling and running. Otherwise, the program will report an error and cannot run.

4. Finally, save the changes and recompile the generated program.

When you open the program again, you will be prompted “user account control” to obtain administrator permissions to run, and click “yes” to obtain administrator permissions.

 

Link to the original text: https://www.cnblogs.com/yuluo/p/5718057.html

Recommended Today

The course of using Chinese software of poedit Pro

Poedit pro (formerly known as poedit) is a free (professional version charge), open source and cross platform gettext class (. Po format, gettext is used in the application program for program internationalization) International Translation editor. It is also one of the most widely used software of the same type. At present, it is available in […]