Wix - Upgrade always starts the old msi installer and does not try to read the old msi

I have a problem, but with caching the Windows installer. I try to update and every time the Windows installer launches the installer of the old version. And when I do the update, it complains about problems reading the old msi file (since it is not in the same directory anymore).

I changed the UpgradeCode and ProductCode code, but kept the PackageCode the same. I also have different ProductVersion codes (2.2.3 vs 2.3.0).

Here is an example of my code:

<Upgrade Id="$(var.UpgradeCode)"> <UpgradeVersion Property="OLDAPPFOUND" IncludeMinimum="yes" Minimum="$(var.RTMProductVersion)" IncludeMaximum="no" Maximum="$(var.ProductVersion)"/> <UpgradeVersion Property="NEWAPPFOUND" IncludeMinimum="no" Minimum="$(var.ProductVersion)" OnlyDetect="yes"/> </Upgrade> 

This is the installation sequence:

 <InstallExecuteSequence> <Custom Action='SetUpgradeParams' After='InstallFiles'>Installed AND NEWAPPFOUND</Custom> <Custom Action='Upgrade' After='SetUpgradeParams'>Installed AND NEWAPPFOUND</Custom> </InstallExecuteSequence> 

The error I am getting is:

When trying to read from a file, a network error occurred:

Thanks,

+4
source share
4 answers

Do NOT save the same PackageCode .

Do you really want this automatically generated ... refer to the documentation:

Non-identical .msi files should not have the same package code. it is important to change the package code because it is the primary identifier used by the installer to search and verify the package is correct for this installation. If a package is modified without changing the code package, the installer cannot use the newer package if both are available to the installer.

Here is an example from our production environment ...

 <Product Id="*" UpgradeCode="$(var.Property_UpgradeCode)" Name="!(loc.ApplicationName)" Language="!(loc.Property_ProductLanguage)" Version="$(var.version)" Manufacturer="!(loc.ManufacturerName)" > <Package Description="!(loc.Package_Description) $(var.version)" Comments="!(loc.Package_Comments)" Manufacturer="!(loc.ManufacturerName)" InstallerVersion="301" Compressed="yes" InstallPrivileges="elevated" InstallScope="perMachine" Platform="$(var.ProcessorArchitecture)" /> 

The current drawback of this approach is that you probably also want to provide major updates that only the update code refers to. Now we can take advantage of the fact that for the Windows Installer packages, only the first three fields are important, for example. 1.0.0.1 and 1.0.0.2 are both interpreted as 1.0.0 (this is explicitly mentioned in the documentation, so we can rely on it.)

Expanding this logic, we can automatically increase the (ignored) fourth version field with each assembly, but prevent updating when the first three match.

  <UpgradeVersion Property="ANOTHERBUILDINSTALLED" Maximum="$(var.version)" Minimum="$(var.version)" IncludeMinimum="yes" IncludeMaximum="yes" OnlyDetect="yes" /> 

The growth potential is completely transparent to customers, but it does not allow internal testing / QA teams to install one “build” on top of another, and you also need to ensure that immediately after any public release you manually increase one of the first three versions.

+3
source

You need to keep the update code the same and change the product code (if you want to update).

In InstallExecuteSequence you will need the following line

 <RemoveExistingProducts After="InstallInitialize" /> 

I decided to include the action after the installInitialize sequence in this example, however you can put them in other places, which will give you various effects.

This is a good link.

+2
source

Here's the source code (or as much as I can give):

http://schemas.microsoft.com/wix/2003/01/wi '>

.....

 <Package Id='$(var.PackageCode)' Comments='$(var.App_LongName)' Description='$(var.App_LongName) setup package' Manufacturer='$(var.Manufacturer)' InstallerVersion='200' Languages='1033' SummaryCodepage='1252' Compressed='yes' Keywords='Installer,$(var.App_ShortName)' /> <FragmentRef Id='AppInstaller.UI' /> <!-- Upgrade table --> <Upgrade Id="$(var.UpgradeCode)"> <UpgradeVersion Minimum="$(var.ProductVersion)" IncludeMinimum="no" OnlyDetect="yes" Property="NEWPRODUCTFOUND" /> <UpgradeVersion Minimum="$(var.RTMProductVersion)" IncludeMinimum="yes" Maximum="$(var.ProductVersion)" IncludeMaximum="no" Property="UPGRADEFOUND" /> </Upgrade> ..... <!-- Prevent downgrading --> <CustomAction Id="NewerVersionDetected" Error="$(loc.App_WixUI_NewerVersionDetected)" /> ...... <CustomAction Id="SetDeployParams" Return="check" Property="Deploy" Value="Deploy|[DB_USER]|[DB_PW]|[DB_PORT]|[WS_USER]|[WS_PW]|[WS_PORT]|[PROTOCOL]|[HOST]|[TIMEOUT]|[#App.WAR]|[#CONTEXT.XML]" /> <CustomAction Id="Deploy" JScriptCall="main" Property="Script" Execute="deferred" Return="check" /> <CustomAction Id="SetRollbackParams" Return="check" Property="RollbackDeploy" Value="Rollback|[DB_USER]|[DB_PW]|[DB_PORT]|[WS_USER]|[WS_PW]|[WS_PORT]|[PROTOCOL]|[HOST]|[TIMEOUT]|[#App.WAR]|[#CONTEXT.XML]" /> <CustomAction Id="RollbackDeploy" JScriptCall="main" Property="Script" Execute="rollback" /> <CustomAction Id="SetUnDeployParams" Return="check" Property="UnDeploy" Value="Undeploy|[DB_USER]|[DB_PW]|[DB_PORT]|[WS_USER]|[WS_PW]|[WS_PORT]|[PROTOCOL]|[HOST]|[TIMEOUT]|[#App.WAR]|[#CONTEXT.XML]" /> <CustomAction Id="UnDeploy" JScriptCall="main" Property="Script" Execute="deferred" Return="check" /> <CustomAction Id="SetRepairParams" Return="check" Property="Repair" Value="Repair|[DB_USER]|[DB_PW]|[DB_PORT]|[WS_USER]|[WS_PW]|[WS_PORT]|[PROTOCOL]|[HOST]|[TIMEOUT]|[#App.WAR]|[#CONTEXT.XML]" /> <CustomAction Id="Repair" JScriptCall="main" Property="Script" Execute="deferred" Return="check" /> <CustomAction Id="SetUpgradeParams" Return="check" Property="Upgrade" Value="Upgrade|[DB_USER]|[DB_PW]|[DB_PORT]|[WS_USER]|[WS_PW]|[WS_PORT]|[PROTOCOL]|[HOST]|[TIMEOUT]|[#App.WAR]|[#CONTEXT.XML]" /> <CustomAction Id='Upgrade' JScriptCall="main" Property="Script" Execute="deferred" Return="check" /> <CustomAction Id="PreventDowngrading" Error="Newer version already installed." /> <InstallUISequence> <FindRelatedProducts Sequence="200" /> <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom> </InstallUISequence> <InstallExecuteSequence> <LaunchConditions After='AppSearch'></LaunchConditions> <RemoveExistingProducts After='InstallFinalize' /> <Custom Action='SetUrl' Before='InstallFiles' /> <Custom Action='SetSecurePort' After='LaunchConditions'>PROTOCOL = "secure"</Custom> <Custom Action='SetNonSecurePort' After='LaunchConditions'>NOT (PROTOCOL = "secure") OR NOT PROTOCOL</Custom> <Custom Action='SetDeployParams' After='InstallFiles'>NOT Installed AND NOT PATCH</Custom> <Custom Action='Deploy' After='SetDeployParams'>NOT Installed AND NOT PATCH</Custom> <Custom Action='SetRollbackParams' Before='RollbackDeploy'>NOT Installed AND NOT PATCH</Custom> <Custom Action='RollbackDeploy' Before='Deploy'>NOT Installed AND NOT PATCH</Custom> <Custom Action='SetUpgradeParams' After='InstallFiles'>Installed AND UPGRADEFOUND</Custom> <Custom Action='Upgrade' After='SetUpgradeParams'>Installed AND UPGRADEFOUND</Custom> <Custom Action='SetRepairParams' After='InstallFiles'>Installed AND NOT REMOVE="ALL" AND NOT NEWAPPFOUND</Custom> <Custom Action='Repair' After='SetRepairParams'>Installed AND NOT REMOVE="ALL" AND NOT NEWAPPFOUND</Custom> <Custom Action='SetUnDeployParams' After='MsiUnpublishAssemblies'>Installed AND REMOVE="ALL" AND NOT NEWAPPFOUND</Custom> <Custom Action='UnDeploy' After='SetUnDeployParams'>Installed AND REMOVE="ALL" AND NOT NEWAPPFOUND</Custom> <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom> </InstallExecuteSequence> 

0
source

What does your product item say?

You need to specify the same update code in the update table and product table, i.e.

 <Product Id="..." Language="..." Manufacturer="..." Name="..." UpgradeCode="$(var.UpgradeCode)" Version="..." > 

and it should be in the source, and if it was not listed there, then maybe you can run CA to remove it using the shell command.

In addition, everything looks fine.

Does the magazine say nothing in the "Findrelatedproducts" section?

0
source

Source: https://habr.com/ru/post/1309052/


All Articles