简体   繁体   中英

VS2010 setup project - Launch application after install as administrator using PostBuildEvent

I have a Winform application that was developed using VS2010 C# I created an installer(setup) project and everything worked great. The main application changes the network metric of a proprietary network adapter and has to be run as administrator to function properly. This was done by adding an app.manifest with <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

Then we decided that we want the option to launch the app directly after install. I did this by adding the following PostBuildEvent: cscript.exe "$(ProjectDir)EnableLaunchApplication.js" "$(BuiltOuputPath)" The .js file can be found on Aaron Stebner's blog at http://blogs.msdn.com/b/astebner/archive/2006/08/12/696833.aspx The only thing I changed was the name of the .exe that is called.

Now my application is started after the install, no problem. Only issue is that it is not started with elevated privileges so it does not function properly! If I close the application after install and start it from the desktop shortcut or the programs menu it is started with elevated privileges and working as expected.

The .js file is something that I do not really know how to debug so this is a bit of a blind spot to me. I think I must at some point add the ability there to start the app in admin mode but I have no clue how, any help please?

Thank you.

我还没有尝试过,但是从我读到的内容来看,我认为将使用安装期间使用的凭据启动自定义操作(请参阅本教程 )。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM