| View previous topic :: View next topic |
| Author |
Message |
kgober Teh Decal L33T!

Joined: 26 Apr 2002 Posts: 1045
|
Posted: Fri Apr 16, 2004 9:45 am Post subject: How to make an MSI file automatically remove old versions |
|
|
This is the procedure I use to make msi files that automatically uninstall older versions before installing (and to prevent an older version from installing if a newer one is already installed).
The tools required are Visual Studio Installer 1.1 (VSI) and Orca, which comes with the Windows Installer SDK.
before using Orca, this is what you need to do in VSI.
first, make sure that your 'upgrade' MSI has the same upgrade code as all of your previous versions (you can think of the upgrade code as a 'product family' code). this value is used by Windows Installer to locate other versions of your application
second, make sure that your new MSI has a *different* product code than any other MSI (think of the product code as a 'this specific msi file version' code. this value is used by Windows Installer to recognize that this version of your application is different from any other version that might already be installed (so it knows whether to upgrade or repair).
third, make sure you change the MSI version number. this value is used by Windows Installer to figure out which MSI files are for newer versions, and which ones are for older versions (you don't want old msi files to 'upgrade' your new installations, you only want new versions to upgrade old ones).
version numbers are typically numbers of the form a.b.c.d, but Windows Installer only looks at the a.b.c part of the number when checking versions. Visual Basic, meanwhile, only generates meaningful information for the a, b and d parts (it makes version numbers like this: a.b.0.d). so, if you're using VB, you need to change either the major version, the minor version, or both (a and/or b). if you're using another language, you can change a, b and/or c.
once all that is done, make your msi file, then open it up in Orca.
in the CustomAction table, add the following entry:
| Code: |
Action Type Source Target
------ ---- ------ ------
CA1 19 A newer version is already installed.
|
in the InstallExecuteSequence table, add the following entries:
| Code: |
Action Condition Sequence
------ --------- --------
FindRelatedProducts 200
CA1 NEWPRODUCTFOUND 201
RemoveExistingProducts 1450
|
in the InstallUISequence table, add the following entry:
| Code: |
Action Condition Sequence
------ --------- --------
FindRelatedProducts 1002
|
in the Property table, add the following entries:
| Code: |
Property Value
-------- -----
RemovePreviousVersion TRUE
SecureCustomProperties NEWPRODUCTFOUND;UPGRADEFOUND
|
add the Upgrade table, and make the following entries (substitute the actual msi version and upgrade code in place of <version> and <upgrade code>):
| Code: |
UpgradeCode VersionMin VersionMax Lang Attr Remove ActionProperty
----------- ---------- ---------- ---- ---- ------ --------------
<upgrade code> 0.0.0 <version> 0 256 UPGRADEFOUND
<upgrade code> <version> 0 2 NEWPRODUCTFOUND
|
save the msi file in Orca, and you're done!
-ken |
|
| Back to top |
|
 |
Digero

Joined: 15 May 2003 Posts: 426
|
Posted: Mon Apr 19, 2004 10:49 am Post subject: |
|
|
I get the following errors after trying this:
ICE03 ERROR Table: Upgrade Column: UpgradeCode Missing specifications in _Validation Table (or Old Database)
ICE03 ERROR Table: Upgrade Column: VersionMin Missing specifications in _Validation Table (or Old Database)
ICE03 ERROR Table: Upgrade Column: VersionMax Missing specifications in _Validation Table (or Old Database)
ICE03 ERROR Table: Upgrade Column: Language Missing specifications in _Validation Table (or Old Database)
ICE03 ERROR Table: Upgrade Column: Attributes Missing specifications in _Validation Table (or Old Database)
ICE03 ERROR Table: Upgrade Column: Remove Missing specifications in _Validation Table (or Old Database)
ICE03 ERROR Table: Upgrade Column: ActionProperty Missing specifications in _Validation Table (or Old Database)
ICE17 WARNING Property SF_Bitmap in Text column for Control: 'Control7' of Dialog: 'SplashForm' not found in Property table, so no default value exists.
ICE17 WARNING Property SF_Bitmap in Text column for Control: 'Control6' of Dialog: 'SplashForm' not found in Property table, so no default value exists.
ICE27 ERROR 'FindRelatedProducts' Action in InstallUISequence table in wrong place. Current: Selection, Correct: Search
When i try to run the MSI it says it's invalid.
I tried adding the values that it wanted into the Validation table (just the three required fields: Table, Column, and Nullable), and changed the FindRelatedProducts Sequence around until it stopped giving errors (701), but even with all of the errors gone, it still said the MSI was invalid after saving it. |
|
| Back to top |
|
 |
kgober Teh Decal L33T!

Joined: 26 Apr 2002 Posts: 1045
|
Posted: Tue Apr 20, 2004 12:05 am Post subject: |
|
|
was your original MSI created with VSI 1.1? or something else, like Wise Installer?
the version of Orca I use (successfully) is 2.0.3790.0
-ken |
|
| Back to top |
|
 |
Digero

Joined: 15 May 2003 Posts: 426
|
Posted: Tue Apr 27, 2004 5:58 am Post subject: |
|
|
I got it working -- i'm not sure what I did though lol
Thanks  |
|
| Back to top |
|
 |
Digero

Joined: 15 May 2003 Posts: 426
|
Posted: Tue May 04, 2004 4:06 am Post subject: |
|
|
Bah, I just had the same problem again, and it turned out the reason was that I was trying to run the installer while Orca was still open . Just a heads up for anyone else trying this hehe, close Orca before testing the installer  |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|