我遇到了安装程序的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>
我得到的错误是:
尝试从文件中读取时发生网络错误:
谢谢,
答案 0 :(得分:3)
您真的希望自动生成...请参阅文档:
不相同的.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团队在另一个上面安装一个“构建”,并且还需要确保在任何公开发布后立即手动增加前三个中的一个版本字段。
答案 1 :(得分:2)
您需要保持升级代码相同并更改产品代码(如果您想要升级)。
在InstallExecuteSequence中,您需要以下行
<RemoveExistingProducts After="InstallInitialize" />
我已选择在此示例中的installInitialize序列之后执行操作,但是您可以将它们放在其他位置,这会给您不同的效果。
答案 2 :(得分:0)
这是源代码(或者我可以提供的内容):
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>
答案 3 :(得分:0)
您的产品元素说了什么?
您需要在升级表和产品表中指定相同的升级代码,即
<Product
Id="..."
Language="..."
Manufacturer="..."
Name="..."
UpgradeCode="$(var.UpgradeCode)"
Version="..."
>
并且它必须是原始的,如果它最初没有在那里指定那么也许你可以运行CA来用shell命令删除它。
除此之外,一切看起来还不错。
在日志中它是否在“Findrelatedproducts”部分中说了什么?