I have a basic setup project in Visual Studio 2010, and I am struggling with setting up custom actions. I have 3 Installer classes in a separate assembly.
The 3 classes do the following things:
- Check for parameters to allow for unattended installation with licensing information (overrides the
Installmethod) - Remove a previous installation of the software (installed with an NSIS installer, uses the
BeforeInstallevent) - Stop the program if it is running, using the
BeforeInstallevent
The problem is the last one, it seems the BeforeInstall event is never triggered. I've tried to make it create a file on disk, and displaying a MessageBox. It never triggers.
The "Primary output from SetupActions" has been added to the "Install" section in the Custom Actions editor. My Installer classes all have [RunInstaller(true)].
Code that does not work:
[RunInstaller(true)]
public partial class InstallerStopProgram : System.Configuration.Install.Installer
{
public InstallerStopProgram()
{
InitializeComponent();
}
private void InstallerStopProgram_BeforeInstall(object sender, InstallEventArgs e)
{
MessageBox.Show("This is never displayed during the install");
}
}