Announcement

Collapse
No announcement yet.

Uninstall previous version

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Uninstall previous version

    Hello,

    I want to uninstall the previous version of the software deployed created with Setup Factory, but I am currently blocked.

    I found the following topics on this subject, but they are quite old:
    https://forums.indigorose.com/forum/...d-uninstall-it
    https://forums.indigorose.com/forum/...?t=32897&page=

    Can you please provide help on how to uninstall the previous version before installing the new one?

    Thank you,
    Cosmin

  • #2
    I believe that you already found the link to the installer of my custom screen, which I provided to help uninstall a previous version of the same product before deploying a new version. I had a complete page with further description about how to use this script, but it is currently offline. You can find the following information in these forums, but basically, this is what you would need to do if you chose to use my custom screen:

    1) Download the installer and run it, to add the "Former Install Found" screen to your gallery of screens.

    2) Once you have installed this, open the project, and add the screen, typically right before the "Ready to Install" screen.

    3) Add the following code to the On Pre Install event script:
    Code:
    -- place this in the On Pre Install event script
    if (bRequestedUninstall) then
        if (File.DoesExist(sMyUninstallInfo[1])) then
          Application.Minimize();
          -- perform a silent uninstall of the application
          -- add quotes to configuration file argument (it may contain spaces) and add /S at the end
          res = File.Run(sMyUninstallInfo[1], '"'..sMyUninstallInfo[2]..'" /S', "", SW_SHOWNORMAL, true);
          error = Application.GetLastError();
          if (error ~= 0) then
             Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
          else
             SetupData.WriteToLogFile("Info\tUninstallation performed successfully\r\n", true);
          end
          Application.Restore();
          -- wait for the uninstaller to be deleted in the background before deploying the new files
          StatusDlg.Show();
          StatusDlg.SetTitle("Deleting old version");
          StatusDlg.SetMessage("Please wait...");
          StatusDlg.ShowProgressMeter(false);
          while File.DoesExist(sMyUninstallInfo[1]) do
             SetupData.WriteToLogFile("Waiting one second...\r\n", true);
             Application.Sleep(1000);
          end
          StatusDlg.Hide();
       else
          SetupData.WriteToLogFile("Error\tUninstaller could not be found!\r\n", true);
       end
    end
    4) If you inspect the code above, you will see that it attempts to run the uninstaller silently. For this to work as expected, it is required that the option for silent uninstall is indeed enabled in the project settings. If you did not allow a silent uninstall in your previous project settings, then the currently installed version cannot be removed without showing the wizard. Enable the silent uninstall now, so at least future uninstalls can be performed silently.

    5) These scripts assume that you did not make major changes from the default settings in the "Control Panel" dialog of the Uninstall Settings. If you are not using %ProductName% in the unique registry key, then the detection will not work without modifications.

    6) Like all my plugins and scripts, this was developed independently and is not officially supported by Indigo Rose, neither is it part of product support. If you need further assistance on this matter, please contact me privately and I will be happy to provide consulting services.

    Ulrich

    Comment


    • #3
      Thank you for your help, Ulrich.
      I was able to add the uninstall feature to the installer and it works just fine.

      Comment

      Working...
      X