How to run installed program in Visual Studio setup


How to run installed program in Visual Studio setup project

Developer will often want to launch just-installed program at the end of installation. In Visual Studio 2005 setup project, this can be accomplished by adding custom action in the Commit phase, and adding primary output to the custom action. This, however, will fail because Visual Studio places custom action in execute sequence before InstallFinalize, so the file is not ready yet. Another, more involved way is adding InstallerClass and launching the program from there. This is probably even less reliable, especially taking into account the fact that managed code in fact is not even supported by Installer.

The proper way to accomplish this involves direct editing the MSI by ORCA (or other capable editor)

  • open table Files and make note of the value in the column File of the file that we want to launch; for example.
  • in table CustomActions, create new custom action with type=210 (launch from installed files) and any name, for example LaunchMe.
  • in table InstallExecuteSequemce, add new line with sequence next after InstallFinalize, action=(name from (1)), and condition Not Installed. Because by the time of InstallFinalize the installation is complete, this ensures that the program is launched only in case of successful installation.



This site was last updated 12/25/12