Question How do i run my program in administrator mode

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
520
Programming Experience
3-5
I try to change this to requireAdministrator mode in app.manifest
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

but then it say clickonce doesnt support requireAdministrator, even if i uncheck clickonce, when i publish it come back on. How do i run my program in admin mode?
 
Startng a new Process with 'runas' Verb is possible, also for ClickOnce app.
 
so what you are saying is, i need to make another program just to run this program as admin :)
 
right now i made a bat file with the appref-ms name in it and put that as filename and it work. If i put the ms file name in the filename field, it give me error.
 
Have no idea (unless it was deployed in the same location) - I thought you were restarting your own app as admin.
 
Ok I found out that if i use Reflection.Assembly.GetExecutingAssembly.Location to open the app, Update doesn't work anymore. I usually use Reflection.Assembly.GetExecutingAssembly.GetName.Version to get the version but now it gives me nothing. So i went back to using the bat file to run the appref-ms location.
 
I read somewhere that "check for update = before application starts" is set for update to happen before the new admin instance is started.
For manual updating do it before you start the new admin ("non-network deployed") instance.

I usually use Reflection.Assembly.GetExecutingAssembly.GetName.Version to get the version but now it gives me nothing.
Shouldn't be affected, don't know what you mean by "gives me nothing".
 
I do manual Update when i am running the App, i dont like having that update window popup before the app runs. I use My.Application.Deployment.Update()
 
Back
Top