Uninstall former version

  • Print

If you wish to uninstall the existing version of your product automatically when your customer runs the installer made with Setup Factory of a newer (or the same) version, you can use this screen and script:

How to use

  • Download the installer below and select the desired package for installation. The files will be deployed in:

    For Windows XP:
    C:\Documents and Settings\All Users\Application Data\IndigoRose\Setup Factory\9.0\Screens\

    For Windows Vista or Windows 7:
    C:\ProgramData\IndigoRose\Setup Factory\9.0\Screens\

  • Include the custom screen in your installer, offering the option to uninstall the former version of your product before deploying the new files. The screen is named "Former install found":
  • Finally, you should then include the following code in the On Pre Install script:
-- check if uninstall was requested
if (bRequestedUninstall) then
    if (File.DoesExist(sMyUninstallInfo[1])) then
        -- 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);
            SetupData.WriteToLogFile("Info\tUninstallation performed successfully\r\n", true);
            -- wait for the uninstaller to be deleted in the background
            -- before deploying the new files (it can take a second or two)
            StatusDlg.SetTitle("Deleting old version");
            StatusDlg.SetMessage("Please wait...");
            while File.DoesExist(sMyUninstallInfo[1]) do
                SetupData.WriteToLogFile("Waiting one second...\r\n", true);
        SetupData.WriteToLogFile("Error\tUninstaller could not be found!\r\n", true);


Custom Screens for Setup Factory 9

Click to downloadFile size: 1.92 MB
Current version:
Updated: February 2013

Example project

Click to downloadFile size: 18 KB
Updated: October 2010

Make sure that you enabled the silent uninstall in your project (see Uninstall > Settings > Options > Allow silent uninstall), or your customer will see the uninstallation wizard.

Don't have Setup Factory?

If you want to purchase a license for Setup Factory 9, now is a good time! You can get 10% off the list price simply by clicking the banner below:



# đặng ngọc nguyễn 2010-11-24 03:52
tôi ở việt nam ( iam from viet nam
i like your web ...
very good !
good luck !
# arno512 2012-03-19 10:30
thank you !
very good...

Add a comment (For questions, please use the contact form!)

Security code

Our Plugins & Examples Feed

  • MSI Factory Project Refactoring

    When you wish to create or derive a new MSI Factory project from an existing...

  • Microsoft .NET Framework 4.5.2 Dependency added

    A new dependency installer was added to the site. Users of Setup Factory can now...

Subscribe now!