title: Running custom action before installation
body: <p>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.</p>
  
  <p>The 3 classes do the following things:</p>
  
  <ul>
  <li>Check for parameters to allow for unattended installation with licensing information (overrides the <code>Install</code> method)</li>
  <li>Remove a previous installation of the software (installed with an NSIS installer, uses the <code>BeforeInstall</code> event) </li>
  <li>Stop the program if it is running, using the <code>BeforeInstall</code> event</li>
  </ul>
  
  <p>The problem is the last one, it seems the <code>BeforeInstall</code> event is never triggered. I've tried to make it create a file on disk, and displaying a <code>MessageBox</code>. It never triggers.</p>
  
  <p>The "Primary output from SetupActions" has been added to the "Install" section in the Custom Actions editor. My Installer classes all have <code>[RunInstaller(true)]</code>.</p>
  
  <p>Code that does not work:</p>
  
  <pre><code>[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");
      }
  }
  </code></pre>