0
votes

Major upgrade automatically uninstalls the existing version and installs the current one.

Unfortunately Major Upgrade is only available for the following Project types: - Basic MSI - InstallScript MSI - MSI Database - Transform

It is not available for the 'InstallScript' project type. How can we achieve what Major Upgrade offers in the 'InstallScript' project type. We want to basically automatically uninstall existing version before proceeding with the current installation.

I tried to use UninstallApplication InstallScript function as well as invoking msiexec from the InstallScript code to manually uninstall before proceeding with the install but these two approaches present two dialog boxes. One to confirm with the removal of the product and other once done removing where you click on the Finish button to exit the uninstallation.

We want what Major Upgrade offers which is no dialogs popping up.

We cannot use 'InstallScript MSI' project type since we are running into some issues with this project type.

Also, we do not want to convert our existing 'InstallSript MSI' project to 'Basic MSI' since we want to reuse the installscripts we have and converting to 'InstallScript' project type would allow us to do so.


thanks for your response Stein.

For Basic MSI, I see below documented from InstallShield. Its seems a drawback not to be able to preserve information using some global variables. Currently we have the 'InstallScript MSI' project and we have installscripts in place which maintains info using global variables. For example, we may lookup and store something and based on that dynamically change checkboxes in the dialog, etc. We also look up and store info that is used later when installscript functions get executed at different stages. But seems with 'Basic MSI' each custom Action calling an InstallScript function is standalone in the sense that what it discovers and sets cannot be used by another custom Action call to another InstallScript function. Any thoughts?


Basic MSI:

Global variables and pointers are no longer maintained between individual InstallScript custom action calls. In addition, each InstallScript

custom action initializes and uses its own individual SUPPORTDIR. Therefore, you cannot share information across individual calls using files

in SUPPORTDIR. For more information, see Global Variables, Global Pointers, and SUPPORTDIR.

Global Variables, Global Pointers, and SUPPORTDIR

With InstallShield 12 and later, when a Basic MSI installation executes an InstallScript custom action, the compiled InstallScript is loaded

before the action is called, and it is unloaded after the action completes. Thus, each InstallScript custom action executes in its own

session with complete InstallScript engine loading and unloading. This behavior is different than with InstallShield 11.5 and earlier: the

compiled InstallScript was loaded once before the first InstallScript custom action that was used by the InstallScript was executed, and it

was unloaded at the end of the installation after all InstallScript custom actions were completed.

A major implication of this change in behavior is that global variables and pointers are no longer maintained between individual

InstallScript custom action calls:

• If you need to store a value across multiple custom action calls, you must use some external mechanism such as the registry, Windows

Installer properties, or an external data file to store the information between calls. If you choose to use Windows Installer properties in

deferred, commit, or rollback InstallScript custom actions, see the guidelines in Windows Installer Properties and Deferred, Commit, and

Rollback InstallScript Custom Actions. • If you need to use a COM object or some other global object across custom action calls, you must initialize the object for each

individual custom action call in order for the object to be valid. Another implication of this change is that each custom action initializes and uses its own individual SUPPORTDIR. Therefore, you cannot share

information across individual calls using files in SUPPORTDIR, since each custom action invocation will have its own unique SUPPORTDIR. You

can share information using FOLDER_TEMP or some other file location.

Note that FOLDER_TEMP may not be the same path for all of your InstallScript custom actions. If you have some InstallScript custom actions

that run in system context and some that do not, they will have different temp paths if the package is running in an elevated state. The

InstallScript custom actions run in the context of a different user, so storing files in the temp directory and retrieving it later may not

work in certain scenarios.


1

1 Answers

0
votes

I will follow up and evolve this answer as I understand more about your scenario. This will be very general:

Reliable Silent Running: The reliable silent running might be MSI's strongest advantage. It is probably the most significant improvements from older, script based technologies.

Response Files: It has been ages since I looked at an Installscript setup (non-MSI), but essentially they need silent response files (IS help) to run properly in silent mode (essentially a recorded list of what the user choices were in each setup dialog), and they are not always reliable (say a special condition on a machine triggers a dialog that was not recorded in the original run when you recorded your response file). You should record a silent response file both for the setup's installation and its uninstallation (they will be different - some people try to use the install response file for the uninstall - that doesn't work).

Advice: I am confused with regards to your overall situation. You seem to not be using MSI at all, but want major upgrade functionality? Basic MSI projects can contain any number of Installscript custom actions - without problems. What you lose, off the top of my head, is a number of events that are available in Installscript MSI (and older Installscript projects) and the Win32 dialogs that are featured in Installscript setups. Basic MSI is a much better project type, because it is standard MSI and is much less buggy than Installscript MSI.

Installscripts can be called from Basic MSI scripts by inserting a custom action that references an exported Installscript function. Just add a new setup.rul file to your setup project, and then export the functions you want to call from a custom action:

export prototype MyFunction(HWND); <= now this function can be called from a custom action.

There are comments in the setup.rul file explaining the whole process. Just create a blank Basic MSI project, and then insert a new Setup.rul file to study it.