簡體   English   中英

Wix - 升級總是運行較舊的安裝程序msi,並且嘗試讀取舊的msi失敗

[英]Wix - Upgrade always runs older installer msi and fails in trying to read old msi

我遇到了安裝程序的Windows緩存問題。 我正在嘗試進行升級,每次Windows安裝程序都啟動舊版本的安裝程序。 當我進行升級時,它會抱怨讀取舊版本的msi文件時出現問題(因為它不再位於同一目錄中)。

我確實更改了UpgradeCode和ProductCode,但保持PackageCode相同。 我也有不同的ProductVersion代碼(2.2.3對2.3.0)。

這是我的代碼示例:

<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>

這是安裝順序:

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

我得到的錯誤是:

嘗試從文件讀取時發生網絡錯誤:

謝謝,

不要讓同樣的PackageCode

你真的希望自動生成這個...參考文檔:

不相同的.msi文件不應具有相同的包代碼。 更改包代碼非常重要,因為它是安裝程序用於搜索和驗證給定安裝的正確包的主要標識符。 如果在不更改程序包代碼的情況下更改程序包,則安裝程序仍可訪問這兩個程序包時,安裝程​​序可能不會使用較新的程序包。

以下是我們生產環境的一個例子......

<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)" />

現在這種方法的缺點是它意味着您可能還希望強制執行主要升級,這只需要關注所引用的升級代碼。 現在我們可以利用以下事實:對於Windows Installer程序包,只有前三個字段是重要的,例如1.0.0.1和1.0.0.2都被解釋為1.0.0(這在文檔中明確提到,所以我們可以依賴它。)

擴展此邏輯,我們可以在每次構建時自動遞增(忽略)第四個版本字段,但在前三個相同時阻止升級。

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

好處是對客戶完全透明,但是防止內部測試/ QA團隊在另一個上面安裝一個“構建”,您還需要確保在任何公開發布后立即手動增加前三個版本字段之一。

您需要保持升級代碼相同並更改產品代碼(如果您想要升級)。

在InstallExecuteSequence中,您需要以下行

<RemoveExistingProducts After="InstallInitialize" />

我已經選擇在此示例中的installInitialize序列之后執行操作,但是您可以將它們放在其他位置,這將給您不同的效果。

這是一個很好的參考

這是源代碼(或者盡我所能):

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>

您的產品元素說什么?

您需要在升級表和產品表中指定相同的升級代碼,即

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

並且它需要在原始的那個,如果它最初沒有在那里指定那么也許你可以運行CA以使用shell命令將其刪除。

一切都看起來不錯。

在日志中它是否在“Findrelatedproducts”部分中說了什么?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM