wix – MSI主要升级覆盖规则

我想我在某个地方读过它,但现在无法找到它并且无法确认它:当安装(主要升级)来自MSI的新版本时,如果文件已被修改(由安装程序或用户),则认规则是旧文件不会被新版本中的同一文件替换?

我想我也观察过我之前编写的安装程序中的行为,但现在经过一些更改后,似乎总是会替换旧的修改后的配置文件

产品定义:

<Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Advanced Software Solution" UpgradeCode="$(var.UpgradeCode)">
        <Package Id="*"  InstallerVersion="200" Description="The web service installer" Compressed="yes" 
             InstallScope="perMachine"/>
    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />

组件定义:

<Component Id='WebConfigComp' Guid='GUID'>
        <File Id='WebConfigFile' Name='Web.config' Source='$(var.TheWebService.WCF.TargetBinPath)\Web.distribution.config'
              KeyPath='yes'>
        </File>
      </Component>

InstallExecutesequence

FindRelatedProducts     25
AppSearch               50
LaunchConditions        100
ValidateProductID       700
myScripts_CA            799
Costinitialize          800
FileCost                900
CostFinalize            1000
MigrateFeatureStates    1200
InstallValidate         1400
RemoveExistingProducts  1401
InstallInitialize       1500
BackupCA    Installed   1501
ProcessComponents       1600
UnpublishFeatures       1800
SchedSecureObjectsRollback_x64  VersionNT > 400 1801
RemoveFiles         3500
RemoveFolders       3600
CreateFolders       3700
InstallFiles        4000
InstallServices VersionNT   5800
SchedSecureObjects_x64  NOT REMOVE~="ALL" AND VersionNT > 400   5801
ConfigureIIs    NOT SKIPCONfigUREIIS AND VersionNT > 400    5999
RegisterUser        6000
RegisterProduct     6100
PublishFeatures     6300
PublishProduct      6400
InstallFinalize     6600
LunchWCFReadme  NOT Installed   6601

更新:我刚刚创建了一个用于测试的新项目,观察到相同的行为(修改后的文件被较新版本的安装程序替换),而不更改认的InstallExecSequence.这可能意味着即使文件版本控制应该适用,但它实际上没有被踢入影响结果预期因为删除旧版本太早发生认为Glytzhkof和PhilDW指出.

我正在使用Wix 3.8,目前稳定,我错过了什么?

UPDATE2:
到目前为止,我可以确认在InstallFiles之后移动RemoveExistingProducts将保留修改的无版本文件.但问题是看起来与MajorUpgrade发生冲突

<InstallExecuteSequence>
      <RemoveExistingProducts After="InstallExecute" />
    </InstallExecuteSequence>

我正在添加,错误消息是

Error 1 Duplicate symbol
‘WixAction:InstallExecuteSequence/RemoveExistingProducts’ found. This
typically means that an Id is duplicated. Check to make sure all your
identifiers of a given type (File,Component,Feature) are
unique. C:\TestDev\MySetupTest\MySetupTest\Product.wxs 5 1 MySetupTest

这也不是很有帮助.

最后更新:
在挖掘网络物品一段时间后,找出问题所在:

By default,MajorUpgrade schedules RemoveExistingProducts after
InstallValidate. You can change the scheduling using the Schedule
attribute. For example,If you choose to schedule it after
InstallInitialize,it will look like the following:

<MajorUpgrade
  Schedule="afterInstallInitialize"
  DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will Now exit.">

资料来源:Wix Toolset website

所以包括MajorUpgrade确实会为你改变RemoveExistingProducts序列,这是一个有用的功能,但对我来说是意想不到的.感谢所有的帮助,现在开始的事情对我有意义.毕竟是一个幸福的结局!

如果主要升级在安装新版本之前卸载现有安装(InstallInitialize之前的RemoveExistingProducts),它通常会删除最初安装的所有文件 – 这包括可能已修改文件.然后新版本安装了一个新的文件包.

如果在InstallFinalize之后安排RemoveExistingProducts,则在删除过时文件之前安装新版本的文件.在这种情况下,文件仅在版本化且比安装文件更新时才被替换,对于未版本化的文件(如txt,pdf等),文件替换规则基本上表明文件只有在未更改时才会被覆盖.磁盘.

因此,在InstallFinalize之后移动RemoveExistingProducts可能会解决您的文件“替换问题”,这实际上是在您当前的升级策略重新安装的卸载过程中删除修改文件的情况.

相关文章

Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...
Windows文件操作基础代码 Windows下对文件进行操作使用的一段...
Winpcap基础代码 使用Winpcap进行网络数据的截获和发送都需要...
使用vbs脚本进行批量编码转换 最近需要使用SourceInsight查看...