In windows7, Administrator privileges are required to change or access system settings. For the development of such king of applications that need administrator privileges you must apply some settings on your application in the development process.
Applications that are enabled to run as administrator contains image on its icon.
Run Application In Admin Mode
You can add the function to run application in administrator mode by following simple steps.
- Open your project in Visual Studio 2010
- Click on Project Menu -> (Your Project) Properties
- Go to Security Tab
- Enable ClickOnce Security Setting and Then Disable it again
- Press CTRL + S to save settings
- In the Solution Explorer Click the arrow at the left of properties folder
- From the list of files in the properties folder double click on the app.menifest file to open it
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
and replace it with
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
We just change the value of attribute level from asInvoker to requireAdministrator
Congrats, Your application can run now in administrator mode. You’ll find yellow icon on your application’s exe file’s icon.