How to run executable at end of Setup Project?

2019-01-26 03:47发布

I have a Visual Studio Setup Project that I use to install a fairly simple WinForms application. At the end of the install I have a custom user interface page that shows a single check box which asks the user if they want to run the application. I've seen other installers do this quite often. But I cannot find a way to get the Setup Project to run an executable after the install finishes. An ideas?

NOTE: You cannot use Custom Actions because these are used as part of the install process, I want to run my installed application once the user presses the 'Close' button at the end of the install.

7条回答
The star\"
2楼-- · 2019-01-26 04:03

you can do it by custom installer. just add installer class and there u will see many event like after install, before install. just hook up after install and from there run ur exe by process class. i would suggest u google to find more about custom installer. here is one good link that might help u http://www.codeproject.com/Articles/19560/Launching-Your-Application-After-Install-using-Vis

thanks

查看更多
相关推荐>>
3楼-- · 2019-01-26 04:04

You can use MSILAUNCH (though I've only got it to work with MSICREATE).

http://www.cornerhouse.ca/en/msi.html

查看更多
我命由我不由天
4楼-- · 2019-01-26 04:07

I believe this is one of the real limitations of the Visual Studio installation project. You need to be able to modify the last page of the installation UI but VS.NET does not give you a way to do this. You could modify the tables in the .MSI after it has been built but VS.NET would probably overwrite these changes each time it is built. You may be able to override the last page using a merge module that you include in the installation project. Either way you will need to become familiar with how the UI dialogs are authored in an .MSI and this is not trivial.

You may want to consider switching to a free script based installer or buy a commercial setup authoring application (just don't buy InstallShield for the love of Pete). Take a look at InstallAware (although I have not used it).

查看更多
冷血范
5楼-- · 2019-01-26 04:18

You also can use custom actions

查看更多
你好瞎i
6楼-- · 2019-01-26 04:18

I've done this for internal apps by creating a VB Script harness that launches the setup executable, waits for it to close, and then launches the second program.

You could also accomplish this with a little more polish using a few Win API calls in a C executable.

查看更多
走好不送
7楼-- · 2019-01-26 04:22

I managed it by doing invoking the Main method the assembly using the following line:

(typeof(ClassWithinAssemblyToExecute)).Assembly.EntryPoint.Invoke(null, new Object[] {} )
查看更多
登录 后发表回答