相关:How to keep a config file when major upgrade in wix v3.8?
引用:http://blogs.msdn.com/b/astebner/archive/2008/10/19/9006538.aspx,http://wixtoolset.org/documentation/manual/v3/howtos/updates/major_upgrade.html,http://www.joyofsetup.com/2010/01/16/major-upgrades-now-easier-than-ever/
如果我使用<MajorUpgrade DowngradeErrorMessage="A newer version is already installed." Schedule="afterInstallInitialize" />
,那么安装程序几乎可以正常工作,除了在安装新产品文件之前删除配置文件和其他所有内容。我完全知道afterInstallInitialize
指定了这种行为。
但是我想保留.config
文件(如果它已被修改)(如果创建日期和修改日期不同),所以我将其设置为keyPath='yes'
并尝试安排RemoveExisingProducts
在引用计数增加Schedule='afterInstallExecute'
之后。
但是当我使用afterInstallExecute
时,它在升级期间的行为并不像我期望的那样(作为全新安装正常工作)。而不是覆盖不标记为keyPath='yes'
(其他所有内容)的文件的新版本,所有,现有文件将保持不变为旧版本。无论如何,安装程序认为它是成功的。
我的wix中的每个文件都有自己的组件,例如:
<Component Id="Host" Guid='*' Win64='yes'>
<File Source='$(var.root)MyLib.dll' />
</Component>
和
<Product Id="$(var.productCode)" Language="1033"
Version="$(var.version)" UpgradeCode="$(var.upgradeCode)">
<Package Id="*" InstallerVersion="405" Compressed="yes" Platform="x64"
InstallPrivileges="elevated" InstallScope="perMachine" />
我正在使用WiX 3.8和Burn bootstrapper,但是如果我在没有引导程序的情况下运行msi就没有变化。 InstallerVersion="405"
vs 200
没有任何区别。
我没有看到任何条件,比如“已经安装时跳过”这类东西。
我还应该寻找什么?我描述的是预期的行为吗?
谢谢!
注意:我的产品版本的格式为0.0.238
,并随每次构建而增加。所以这应该是好的我只使用前三个版本组件。
Allowing installation of component: {...} even though a modified unversioned keyfile exists and file versioning rules would disable the component
... Won't Overwrite; Won't patch; Existing file is unversioned but modified (for my one .config file. CORRECT!)
... Won't Overwrite; Won't patch; Existing file is of an equal version (mostly for DLLs and EXEs)
... Won't Overwrite; Won't patch; Existing file is unversioned and unmodified - hash matches source file (mostly for PDBs and XML)
如果我指定-sf
链接器选项,可能强制文件版本号与产品的整体版本号相匹配(就Windows Installer而言),则GAC安装将失败并显示"Unknown table 'MsiAssemblyName' in SQL query: SELECT Value
FROM MsiAssemblyName
"。所以-sf
可能不是正确的伎俩。
我认为我希望避免在每次构建时更新.NET程序集版本号,只要接口不会更改并且它们只是错误修复。这将使安装机器上的更换更加自动化,对吧?我甚至不确定装配版本是否有必要改变,但无论如何我都要打架。 : - )
答案 0 :(得分:1)
我对此有点困惑,但如果您遵循了组件创建规则,则可以在 InstallFinalize 之后移动 RemoveExistingProducts 。这将在从新版本安装新文件后删除旧版本。这仅在组件引用正确时才能正常工作,但会保留更改的文件。
在 InstallExecuteSequence 的早期插入 RemoveExistingProducts 将完全删除旧版本,然后重新安装所有文件 - 将它们恢复为默认值,前提是它们未设置为永久组件以前的版本。我不认为我在InstallExecute之后曾经使用过这个职位 - 我想你可能会混淆这些名字。