Question

I have a Custom Action that should execute during the Install portion of an .msi setup. I have a previous version that was installed using InstallShield (which was overkill) and wanted to move to the simpler VS Setup Proj because I do not require all the control that an .isproj provides. However, doing a straight install with my new .msi seems to install side by side with the previous version. Here's what I have found out so far:

  1. I have my product ID
  2. I have written code that will uninstall the previous version through creating a process that uses MsiExec.exe (code will follow)
  3. Tried implementing the custom action to uninstall during setup but it seems you can only have one instance of MsiExec.exe running at a time.
  4. Have been to this post (http://stackoverflow.com/questions/197365/vs-setup-project-uninstall-other-component-on-install), which didnt help.

Custom Action code:

        //Exe used to uninstall
        string fileName = "MsiExec.exe";

        //Product ID of versions installed using InstallShield
        string productID = "{DC625BCF-5E7B-4FEF-96DD-3CDBA7FC02C1}";

        //Use /x for uninstall and use /qn to supress interface
        ProcessStartInfo startInfo = new ProcessStartInfo(fileName, string.Format("/x{0}", productID));
        startInfo.WindowStyle = ProcessWindowStyle.Normal;
        startInfo.UseShellExecute = false;

        //Start process
        Process uninstallProcess = Process.Start(startInfo);

        //Wait until uninstall is complete
        uninstallProcess.WaitForExit();

My hope is to eventually deploy my .msi via ClickOnce, so I am hoping for an option that will fit into deployment option. Currently everything is written in .NET 2.0 and VS 2005, but I do have .NET 4.0 and VS 2010 available to me if there is a new option that works.

Any help is appreciated.

Was it helpful?

Solution

I was able to install over the top of the previous install by making the product code of my setup the same as the code of the older version. Didn't dawn on me to try that because when you create a new version of the setup package, VS always prompts you to change your product code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top