加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

wix – MSI主要升级覆盖规则

发布时间:2020-12-13 20:28:49 所属栏目:Windows 来源:网络整理
导读:我想我在某个地方读过它,但现在无法找到它并且无法确认它:当安装(主要升级)来自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:TestDevMySetupTestMySetupTestProduct.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可能会解决您的文件“替换问题”,这实际上是在您当前的升级策略重新安装的卸载过程中删除已修改文件的情况.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读