How to specify user credentials for a click-once application?

前端 未结 3 1343
夕颜
夕颜 2021-02-03 11:08

For a regular .exe file i can always right click and select \"run as..\". How can i run a Click-Once application under different credentials in a similar way?

I am talki

3条回答
  •  迷失自我
    2021-02-03 11:44

    Are you talking about a one off process, or something that needs to happen every time your code is run on multiple computers? Because if you simply want to personally run a ClickOnce app with elevated permissions, its pretty simple. Click once apps reside at %LOCALAPPDATA%\Apps\2.0[ObfuscatedFolderName]. Simply find your app folder ( timestamp should be enough information ), then rightclick your EXE and run as admin.

    If you want to do it in code, the easiest solution is probably to make a shell launcer application around your code, that requests elevated permissions in code. Here is such an example.

提交回复
热议问题