使用 WiX 安装无论版本号如何的文件 [英] Install a file regardless of version number with WiX

查看:29
本文介绍了使用 WiX 安装无论版本号如何的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MyApp 1.0 版包含文件 foo.dll.此文件的版本为 10.5.567.现在MyApp是2.0版本,foo.dll版本是2.0.123.版本比旧版本低.编写此 dll 的供应商决定使用文件版本号倒退.这不是我可以改变的决定.

如何让 WiX 始终安装此文件?

RemoveExistingProducts 操作安排在 InstallFinalize 操作之后,也无法更改.

InstallShield 有一个始终覆盖"标志,但我认为我无法在不通过编译器开关更改所有文件的行为的情况下模仿这一点.我不想要这个.我只想更新这个文件.

我也试过

但这也不起作用.我最终收到错误 2753 文件 foo.dll 未标记为安装".

解决方案

这个帖子已经 10 年了,我们也有这个问题,这真是太疯狂了.其他方法对我们不起作用.

如何解决:

  1. 所有应该复制的文件,无论其版本如何,都必须在它们自己的组件中
  2. Component 元素必须具有唯一的 Guid,不是 *
  3. 在内部 文件 元素

示例:

我建议将所有那些 component 元素聚合到一个组件组中.此外,您可以使用 XML 转换 来摆脱那些文件,如果您使用 heat.exe 来收集所有文件.>

使用此解决方案您可以复制文件,即使安装的文件版本更高.当您的升级安装更高的文件版本时,它仍然可以正常工作.

MyApp version 1.0 contained the file foo.dll. The version of this file was version 10.5.567. Now MyApp is version 2.0 and the version of foo.dll is 2.0.123. The version is LOWER than the old version. The vendor who wrote this dll decided to go backwards with the file version number. This is not a decision I can change.

How do I get WiX to always install this file?

The RemoveExistingProducts action is scheduled after the InstallFinalize action and also cannot be changed.

InstallShield had an 'always overwrite' flag but I don't think I can mimic this without changing the behavior of all files via a compiler switch. I do not want this. I just want to update THIS ONE file.

I have also tried

<RemoveFile Id="foo.dll" On="install" Name="foo.dll" />

But this did not work either. I end up getting 'Error 2753 The file foo.dll is not marked for installation' later.

解决方案

It is really crazy this post is 10 years old and we also have this problem. The other approaches did not work for us.

How to solve it:

  1. All files which should be copied regardless of their version, must be in their own component
  2. Component element must have a unique Guid, not a *
  3. Set KeyPath to no in the inner File element

Example:

<Component Id="cmpExample" Guid="{5ABE7229-C247-4CBA-B8DE-2C4968CD103E}" >
     <File Id="fileExample" KeyPath="no" Source="$(var.TargetDir)\SomeExample.dll" />
</Component>

I would recommend to aggregate all those component elements in a component group. And furthermore you can use XML Transformation to get rid of those files if you use heat.exe to harvest all your files.

With this solution you can copy the file, even if the installed file version is higher. And it still works as expected when a higher file version will be installed with your upgrade.

这篇关于使用 WiX 安装无论版本号如何的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆