Alex Rivera | Logout

How do I force my .NET application to run as administrator?

Asked 2010-05-12T11:09:50.023
1003

Once my program is installed on a client machine, how do I force my program to run as an administrator on Windows 7?

Edit
Report

2 Answers

42

You can embed a manifest file in the EXE file, which will cause Windows (7 or higher) to always run the program as an administrator.

You can find more details in Step 6: Create and Embed an Application Manifest (UAC) (MSDN).

answered 2010-05-12T11:29:30.883
12

As per

<requestedExecutionLevel level="highestAvailable" uiAccess="false" />

you will want to add an application manifest if you don't already have one or don't know how to add one. As some projects don't automatically add a separate manifest file, first go to project properties, navigate to the Application tab and check to make sure your project is not excluding the manifest at the bottom of the tap.

  • Next, right click project
  • Add new Item
  • Last, find and click Application Manifest File
answered 2013-03-17T13:06:32.260

Your Answer