Behaviour Difference Between NEEDSUPGRADE and Uninstall

Got a problem you cannot solve? Try here.
Post Reply
Sheri_Steeves
Posts: 124
Joined: Mon Oct 22, 2012 2:14 pm

Behaviour Difference Between NEEDSUPGRADE and Uninstall

Post by Sheri_Steeves »

Hello,

I've run into an issue that I'm not sure if it is a problem or by design.

When uninstalling, I need to call one of my installed programs to remove a component. This installed program is just a Win32 executable and is also used during the install sequence (after the files are copied to $TARGETDIR$) to add the component as a separate call to Run Program.

Code: Select all

if Variable REMOVE Equals TRUE
  Comment: Uninstall product
  Comment: TO-DO: Insert any additional uninstall commands here
  Run Program $TARGETDIR$\Setups\MyComponentSetup.exe /REMOVE (WAIT)
  Apply Uninstall (get result into variable SUCCESS)
  Set Variable PROGRESS to 100
  else
  ...
I've created a second copy of the project file (with a different name) with a new version number and a new revision code - so after running my command line builds I basically end up with setup_1.0.000 and setup_1.0.001. If I install version 1.0.000 and then run the 1.0.001 install I want the installer to remove the previous install (1.0.000) and then continue on with installing 1.0.001. This sequence I have working with one problem.

My problem is that on the version upgrade install sequence my separate component was not being removed - the shortcuts, menu items, etc were but not this other piece. I ended up having to add an extra Run Command before the call to Install/Remove MSI Package:

Code: Select all

  if Variable NEEDSUPGRADE Equals TRUE
    Set Variable REMOVEOLD to 
    Set Variable ERROROLD to 
    Run Program $TARGETDIR$\Setups\MyComponentSetup.exe /REMOVE (WAIT)
    Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
    if Variable REMOVEOLD Equals ERROR
      MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. Please uninstall it yourself using Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
      Terminate Installation
    end
    if Variable REMOVEOLD Equals REBOOT
      MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, setup will exit. You will have to run setup again at a later time to install $TITLE$.
      if Variable REBOOTNOW Equals OK
        Reboot Computer and Resume Setup
        else
        Terminate Installation
      end
    end
    Set Variable MAINTENANCE to FALSE
  end


Is this the proper way to do this? I expected the uninstall during the upgrade to run the same code as when I uninstall from add/remove programs.

Thanks,

Sheri
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Behaviour Difference Between NEEDSUPGRADE and Uninstall

Post by FrancescoT »

Dear Sheri,
Is this the proper way to do this? I expected the uninstall during the upgrade to run the same code as when I uninstall from add/remove programs.
the difference stay with the fact that when you uninstall an application using Add Remove programs, the code executed is that one from the cached setup source files. In other words, the same packages that you used to execute the setup at the first time, that during installation, it is cashed on the system.

When you execute the updated package (1.00.001), the uninstal call of the previuos package is made through the version upgrade install sequence of your new package.

Said this, if your code resides with "version upgrade install sequence" of your 1.00.000 project version, it will be never called during the execution of 1.00.001 project.

Hope this helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply