cancel
Showing results for 
Search instead for 
Did you mean: 
alanrickman
Pilgrim

Retain ini files during an Upgrade but not Uninstall??

Hi all,

Bit of a newbie when it comes to Installshield and have been given the task of starting the companies installers from fresh.

What I need to do is retain certain ini/xml file(s) (or maybe just the sections\keywords) if its upgrade but remove these files if its full uninstallation, I'm sure this must be achieveable but can't fathom out how :confused: .

Any help would be greatly appreciated!

Alan
Labels (1)
0 Kudos
4 Replies
Sairen
Pilgrim

Re: Retain ini files during an Upgrade but not Uninstall??

Hi, Alan,

I do a lot of work with retaining INI settings and whatnot with our installers, so maybe I can help some. I'm writing from the world of MSI, so if you're not, this may not look right (or be right!)

First, you've got a couple different cases to consider, and I just wanted to outline them briefly so we're at least starting with the same vocab...
*Modify
*Repair
*Remove
These are collectively "maintenance" actions.

Then there's also a minor upgrade, which is meant to update some files, maybe add a registry key... little stuff.

And finally, the major upgrade, which (by default, anyway) uninstalls the previous version before installing the current version.

I suspect it's the major upgrade you're grappling with, since that would remove files. A couple conditions that might be helpful to you:

REMOVE="ALL" : An action with this condition will run during a "real" uninstallation and during the uninstallation part of a major upgrade.
REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE: An action with this condition will not run during a major upgrade, but only when the product is really really being removed.

As to your problem, since installation and removal of files isn't really an action you want to control like this... I can think of a couple ideas.
(1) You could mark the INI files permanent, then create a custom action that will remove them only during a complete uninstallation (see above conditions).

(2) [This is the one we do] Let the files go. Early in installation, use a custom action to read the settings that need to be saved, and store these to a public property. Then, using the built-in actions exposed through "INI File Changes" view, write these public properties back out to the newly installed file. This has the added benefit of letting your developers add new INI settings to new versions and have them be actually distributed to existing customers.

There's a lot of info here, so just write back on whatever you'd like clarification on. Smiley Happy

Good luck!
0 Kudos
alanrickman
Pilgrim

Re: Retain ini files during an Upgrade but not Uninstall??

Thanks for the reply!

Exactly what I was after, think probably best to go for the latter of the two options. Can only see leaving ini files behind causing problems further down the line.

I think those conditions will be particularly useful elsewhere though! Can you recommend a good place in the sequence to read in information from the ini files? I guess before InstallInitalize, or would it be better before that?

Thanks,
Alan
0 Kudos
Sairen
Pilgrim

Re: Retain ini files during an Upgrade but not Uninstall??

I've put mine in the Exec sequence, after InstallValidate, Immediate execution.

Now, since the action to write info to the INI files is unconditional, I've found it works best if reading the INI files also happens (nearly) all the time. The condition I've finally reached for this (which is always a work in progress!) is
NOT (REMOVE="ALL") which should run during any maintenance activity or upgrade except full removal.

Good luck!
0 Kudos
jchristman
Pilgrim

Re: Retain ini files during an Upgrade but not Uninstall??

I have a similar need, I am looking for a file that could live in 3-4 differant places. If it exists in one place I need to read the entire contents and store it then when the installer is done copying the new files I need to write the file back out to 3 differant locations. oh yeah it is a MSI project and I am new to install shield.
0 Kudos