How to restart my application in admin rights in C#

2.9k views Asked by At

I realise something that when I restart my application (with code), it does not restart with admin rights. When I start my app by double clicking, it ask me that you want to run it as an admin and I say yes. But after that I need to restart my application programmatically and it has to restart as also admin but it does not.

I use simply this code to restart

        Application.Restart();

and I added the following line to my app manifest file

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

Edit: I am not looking for using Progress class to restart. can I do it with Application.Restart?

We made a management console and we have plugins and plugins are needed to be updated. Thats why I have to delete the old dlls to upgrade but I receive errors when I try and I believe it is because the program does not have administrator permissions.

0

There are 0 answers