title: How to uninstall automatically while installing new version in msi file
body: <p>I have made a msi project for my software in VS2015. I have made a.Net based desktop application. My requirement is that I would like to handle 2 cases :--</p>
  
  <p>1- If our software is installed already, and user try to install it, it should automatically un-install existing software and delete database file (created by my application).</p>
  
  <p>2- If installed version is lower then it should only uninstall application and leave my database file as it is.</p>
  
  <p>Now in my setup project I have added Custom actions for install and un-install where I have given path of my dll and set Installer Class property to true. In this dll I have made a class inherited from System.Configuration.Install.Installer and handle Install , beforeInstall, uninstall like below :--</p>
  
  <pre><code>    public partial class SetupManager : System.Configuration.Install.Installer
      {
          public SetupManager()
          {
              InitializeComponent();
              this.BeforeInstall += SetupManager_BeforeInstall;
              //this.Committed += new InstallEventHandler(DarkMailInstaller_Committed);
          }
  
          private void SetupManager_BeforeInstall(object sender, InstallEventArgs e)
          {
              MessageBox.Show("In Install event");
          }
  }
  </code></pre>
  
  <p>Now in un-install, I delete DB. it is working fine if I am un-installing from control panel and it removes my DB file as well.</p>
  
  <p>But if I want to upgrade my product, before getting hit in my override function Like install or BeforeInstall it shows error "Another Version of this product is already installed. Installation of this version can not be continue. To configure or remove the existing version of product, use add/remove program of control panel".</p>
  
  <p>Now I have searched on internet and it seems if I update my package code or product version, it should be able to install over it. Now I have following issues :--</p>
  
  <p>1- In VS 2015, I dont have any property in setup project where I can set product version or package code ?</p>
  
  <p>2- I have tried to edit it using Orca but even then if I try to install edited MSI file (with updated version number, package code and product code), I am facing same error.</p>
  
  <p>3- I dont know why this this error is coming before executing Before-install event ?</p>
  
  <p>4- I have found "RemoveExistingProducts" would be helpful in this case. But I can not find this property / action in VS2015. Where can I find it ?</p>
  
  <p>Can some body please help me to solve this issue ? </p>