Question Running as Administrator with ClickOnce

adlev27

New member
Joined
Apr 12, 2009
Messages
3
Programming Experience
Beginner
Hi,

Sorry for the newbie question!

I have an application that requires administrator privileges on Vista to perform some registry modifications. Originally I simply set <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> under UAC settings in VS 2008 however I realise now that I can’t publish the application because "ClickOnce does not support the request execution level 'requireAdministrator'. Am I doing something wrong?

Many Thanks

Adam
 
No, but you can't use ClickOnce for this, use a msi setup project or other installer.
Security, Versioning, and Manifest Issues in ClickOnce Deployments
Alternatives is to create a separate exe that you call with Process class to "run as" a specific admin user, or use impersonation to run part of code in a different user context (see for example http://www.vbdotnetforums.com/security/17261-run-windows-application-specific-user-account.html).

In case you're actually dealing with UAC issues in addition to admin user rights, you have requestedExecutionLevel option, or you can use context menu when starting the app and select "run as administrator", or you can elevate the running/another app by starting a secondary process where you set Verb "runas".
 
Back
Top