views:

2577

answers:

2

I have been able to trigger C# custom actions to overrride install and committ stages of an MSI. However, when deploying an ASP.NET app I wish to be able to perform checks before the install even begins.

I know that there are launch conditions, however, I would like to be able to plug in my own code here to handle checks upon launch myself as from what I see the Launch conditions are simply for checking the correct versions of IIS etc?

Could anyone point me in the right direction here, or even if there is a way to get the Launch conditions to fire some C#?

+1  A: 

I think that using a custom action to set a property value and then running a launch condition to check the property value would be one way. However this doesn't seem to apply to VS Installation Projects, since the custom actions doesn't run until after the launch conditions. WiX will allow greater control and should allow custom actions to be performed earlier.

A crude way of doing it would be to have the custom action throw an exception and have the installation rolled back, but that would be an ugly hack.

I found a forum thread discussing how to check if a certain service is running on installation that perhaps can lead you in the correct direction.

PHeiberg
+1  A: 

Just schedule your custom action immediately after LaunchConditions. The result is the same for all intents and purposes.

In InstallShield that's just a matter of selecting when it runs via the dropdown menus. Or using WiX, that would be something like:

  <Custom Action="BlahBlahBlah" After="LaunchConditions">1</Custom>

As always, for anyone getting started with MSI I recommend reading The Definitive Guide to Windows Installer. It provides invaluable low-level knowledge (using Visual Studio setup projects and Orca) that applies no matter if you're using WiX, InstallShield or any other tool to build MSI files.

sascha