1

Possible Duplicate:
How to force my .NET App to run as administrator on Windows 7?

My application is based on Windows-Thread. So it must run as a administrator privileged, To run the application every user have to do right click and choose "run as administrator" option.

But i don't want to do that, is there any way to change the setup project so that when application installed on windows-machine it sets it privileged with run as administrator and every time when users run it on his local machine , it permanently with run as administrator option.

System: XP, Win-7

Community
  • 1
  • 1
Amit Pal
  • 10,604
  • 26
  • 80
  • 160

1 Answers1

6

You can add/modify the manifest

<requestedExecutionLevel level="requireAdministrator" uiAccess="true"/>

EDIT

See this question and answer to see how to do this for Windows XP: How to run another app as administrator on Windows XP

EDIT

For ClickOnce you could use a trick as mentioned in this blogpost by starting a second process as admin.

Community
  • 1
  • 1
Emond
  • 50,210
  • 11
  • 84
  • 115
  • Thanks for replying, Where i found the `mainfest` file? – Amit Pal Jan 22 '13 at 06:42
  • Read the MSDN page I linked to. You can add it in the project of the program. – Emond Jan 22 '13 at 06:45
  • I added info on fixing this for Windows XP. – Emond Jan 22 '13 at 07:03
  • I added it but it shows me an error: `ClickOnce does not supported the request execution level 'recquireAdministrator'` – Amit Pal Jan 22 '13 at 07:31
  • Please look at the `manifest`file: http://pastebin.com/ugDp3sfF – Amit Pal Jan 22 '13 at 07:38
  • Officially ClickOnce does not support "run as admin" But there is a trick: http://antscode.blogspot.nl/2011/02/running-clickonce-application-as.html Next time please add to your question that you are using clickonce. – Emond Jan 22 '13 at 08:13