Using Visual Studio 2008 to create an msi to deploy my program with a setup project. I need to know how to make the msi run the exe it just installed. A custom action? If so please explain where/how. Thanks.
Visual-studio – Run exe after msi installation
custom-actionsetup-projectvisual studiovisual-studio-2008windows-installer
Related Topic
- R – Launch program after msi installation
- Visual-studio – Cannot import the keyfile ‘blah.pfx’ – error ‘The keyfile may be password protected’
- Create MSI or setup project with Visual Studio 2012
- R – How to catch VBScript runtime error “Object required: ‘Session'” on cmd line where Session isn’t defined for MSI
Best Answer
This is a common question. I don't do it with just a custom action. The only way I know, is to modify the .msi after it has been generated. I run a Javascript script as a post-build event to do exactly that. It inserts a new dialog in the installer wizard, with a checkbox that says "Launch Application Foo?". And then there is a custom action to run the app, if the checkbox is checked.
It appears as the last screen in the install Wizard sequence. Looks like this:
This is the script I use to modify the MSI:
I originally got this from Aaron Stebner's blog, and then modified it.
Save that Javascript file to the project directory (same dir as contains .vdproj), name it
ModifyMsiToEnableLaunchApplication.js
. For each unique setup project, you need to modify that script and put the proper exe name into it. And then, you need to set the post-build event in the Setup project to be this:Be sure to type the name of the macro
$(BuiltOuputPath)
correctly. The wordOuput
is misspelled by Microsoft, andBuilt
is not spelledBuild
!That oughtta do it.
See also: this modification which does not include the "run Foo.exe" checkbox on UNINSTALL.