I have a WPF application that I want to make it able to start always as an Adminstrator. I've been reading a lot about it and it seems that I have to create my own manifest file and pass it to the Application properties so that on runtime it starts as an Administrator.
The application itself loads a file and sometimes the file might demand administrator access so it can be modified. That is why I am looking for a way after the Application gets installed to be able to always get started in administrator mode.
To add a Manifest, right click on your project file in Solution Explorer :
Select Add
New item
Choose Application Manifest File
The file should be named app.manifest . Don't rename it.
You have to change the <requestedExecutionLevel>
element in your Manifest to start always as an Adminstrator:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
BTW: A good article for this question:
https://docs.microsoft.com/en-us/dotnet/framework/ui-automation/ui-automation-security-overview
In Visual Basic, the project properties are structured a little differently. If you find this question and you're in VB in VS2010, follow these instructions to generate an app.manifest file.
Further Reading: WPF MessageBox window style
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.