My app uses ClickOnce tehcnology. Today I needed to run it as administrator. I modified the manifest file from
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
to
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
However VS cannot compile the project:
Error 35 ClickOnce does not support the request execution level 'requireAdministrator'.
I think it's impossible to use them at once. Isn't it? I need to change the system time, can I do that in application level? Can I emulate it, so app. can do what I want. I change time +2 hours then put back for a second. I got a few dlls and they ask for time.
Time is a system-wide thing, you can't change it just for your process. The only way to lie about it to your dependencies is to hook the API, using Detours or something similar. Not allowed if you're a lowly user account.
Modifying the time requires the "Change the system time" and/or "Change the time zone" privileges (which the Administrator account is normally given).
And as mentioned by @Chris, admin and ClickOnce aren't compatible.
If you launching ClickOnce app from IE, to have Administrative privileges just run IE with Administrative privileges and your app will have it too.
Actually You can't run ClickOnce application with Administrative privileges but there is a little hack, you can start new process with Administrator privileges. In App_Startup:
Read full article.
But if you want more native and easier solution just ask a user to run Internet Explorer as administrator, ClickOnce tool also will run with admin rights.
Correct - ClickOnce cannot operator with Administrator priviledges. In fact, it is designed not to.