• Hello and welcome to our new forums. We upgraded our forum sites to a more robust and modern system which we hope you will enjoy. Be sure to check out your profile by clicking the button on the top right and configure your preferences, signature, time zone, avatar, etc. as you wish. If you need help with using this new forum'ware try the help link on the bottom right.

    Click here to review your account now.

Question How do i run my program in administrator mode

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
481
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?
 

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
481
Programming Experience
3-5
Is there a way to run the program as admin after it was published?
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,254
Location
Norway
Programming Experience
10+
Startng a new Process with 'runas' Verb is possible, also for ClickOnce app.
 

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
481
Programming Experience
3-5
so what you are saying is, i need to make another program just to run this program as admin :)
 

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
481
Programming Experience
3-5
how do i refer to the clickonce app in the filename . The fullpath of the appref-ms file?
 

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
481
Programming Experience
3-5
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.
 

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
481
Programming Experience
3-5
That would get your own location, but how do you get another clickone app's location?
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,254
Location
Norway
Programming Experience
10+
Have no idea (unless it was deployed in the same location) - I thought you were restarting your own app as admin.
 

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
481
Programming Experience
3-5
ah i guess that works too , i was using another app to start it as admin
 

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
481
Programming Experience
3-5
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.
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,254
Location
Norway
Programming Experience
10+
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".
 

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
481
Programming Experience
3-5
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()
 
Top Bottom