运行 RemovePreviousVersion 时 MSI 不会安装所有文件

发布于 2024-07-15 05:44:40 字数 338 浏览 7 评论 0 原文

我有一个使用 WiX 版本 3 的 MSI 构建。

我们正在部署的产品的所有以前的安装程序都可以在指定的配置下正常工作(即:如果以前的版本存在,则删除,然后安装新版本) - 但是,我们构建的新 MSI当它通过“首先删除”路径运行时,不要安装所有文件。

如果我们手动删除现有安装,然后运行新版本,则所有文件都会安装 - 当我检查 Orca 中的 MSI 文件时,会显示文件和功能,并且看起来没问题。

我们尝试在打开详细和额外日志记录(/l*vx)的情况下运行,但是我们只能看到文件是否未注册& 然后安装。

有什么想法或建议吗? 这让我们陷入困境。

I have a MSI build using WiX version 3.

All previous installers for the product we are deploying worked fine with the configuration specified (that is: if previous version exists, remove, then install the new version) - however, the new MSIs we build don't install all files when it runs through the 'remove first' path.

If we manually remove the existing installation and then run the new version all the files are installed - and when I examine the MSI file in Orca the files and features are shown and seem to be fine.

We have tried running with verbose and extra logging turned on (/l*vx) however all we can see if that the files are not being registered & then installed.

Any thoughts or suggestions? This is driving us up the wall.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

滥情空心 2024-07-22 05:44:40

根据默认的自定义操作顺序,Windows Installer 确定在删除任何现有版本的软件之前需要安装/覆盖哪些文件。 Windows Installer 使用 REINSTALLMODE 属性的值来告诉它如何决定何时覆盖文件。 如果REINSTALLMODE包含“o”,那么它只会安装版本不同或文件不存在的文件; 仅当文件的修改日期 <= 创建日期(即文件未修改)时,才会安装非版本化文件。 如果 REINSTALLMODE 包含“a”,则它将始终安装该文件,无论现有文件附加的任何版本或日期信息如何。

您的情况很可能发生以下情况:

  1. Windows Installer 确定要安装哪些文件。 它决定不需要安装某些文件(可能是因为它们已经存在并且与 MSI 中的文件具有相同或更新的版本)。
  2. 先前版本的软件将被删除,包括 Windows Installer 确定不需要安装的文件。
  3. Windows 安装程序会安装新安装的文件,但不会安装它确定不需要安装的文件。

最终的结果是,升级软件后,一堆文件丢失了。 设置 REINSTALLMODE=amus 而不是 omus 可能会解决您的问题,但您应该确保您知道这将如何影响您安装的其余部分。 如果您不想覆盖任何文件,则需要将这些组件标记为“从不覆盖”。

Based on the default custom action sequence, Windows Installer determines which files need to be installed/overwritten before removing any existing versions of software. Windows Installer uses the value of the REINSTALLMODE property to tell it how to make decisions about when to overwrite files. If REINSTALLMODE contains an "o", then it will only install files where the version is different or the file doesn't already exist; non-versioned files will only be installed if the Modified Date of the file is <= the Created Date (i.e. the file is not modified). If the REINSTALLMODE contains an "a", it will always install the file, regardless of any version or date information attached to existing files.

What is happening in your scenario is most likely the following:

  1. Windows Installer determines which files to install. It decides that some files don't need to be installed (possibly because they already exist and are of the same or newer versions as the ones in the MSI).
  2. The previous version of software is removed, including the files Windows Installer determined didn't need to be installed.
  3. Windows installer installs files for the new installation, but does not install files that it determined did not need to be installed.

The end result is that a bunch of files are missing after upgrading the software. Setting REINSTALLMODE=amus instead of omus will likely fix your problem, but you should make sure you know how this affects the rest of your installation. If there are any files that you don't want to be overwritten, you will need to mark those components to "Never Overwrite".

北座城市 2024-07-22 05:44:40

好的,与我所在的其他人交谈帮助我找到了问题的解决方案。

我们添加了属性 REINSTALLMODE 并将其设置为 amus。 这是什么意思?

默认情况下,该属性设置为 omus,这意味着:如果文件丢失或较旧,则重新安装,重写计算机和用户配置单元的注册表,重新安装快捷方式。 将其更改为 amus 基本上表示:重新安装所有文件。

所以,不能 100% 确定原因是什么 - 我怀疑可能有奇怪的锁或其他东西,但设置为 amus 不会产生任何不利影响,所以我们会坚持这样做。

感谢您的建议。

(此外,可以在此处找到有关此属性的更多详细信息:MSDN:REINSTALLMODE 属性

OK, well talking to someone else where I am helped me find a solution to the problem.

We added the property REINSTALLMODE and set it to amus. What does this mean?

By default the property is set to omus which means: Reinstall if the file is missing or older, rewrite registry for machine and user hives, reinstall shortcuts. Changing this to amus basically says: Reinstall all files.

So, not 100% sure what the cause was - I suspect there may have been strange locks or something, but setting to amus doesn't being on any adverse effects, so we'll stick with that.

Thanks for the suggestions.

(Also, more details on this property can be found here: MSDN: REINSTALLMODE Property

聊慰 2024-07-22 05:44:40

您的 步骤是什么样的? 可能是在安装后运行了removeexisting,并删除了先前版本和当前版本中相同的所有文件。

我将安装程序设置为 以确保它在其他任何操作之前完成。 我不知道这是否正确,但它似乎有效。

    <Upgrade Id="$(var.UpgradeCode)">
        <!--Upgrade code found at http://www.nichesoftware.co.nz/blog/200809/upgradable-msi-installations-with-wix -->
        <!-- Detect any newer version of this product-->
        <UpgradeVersion Minimum="$(var.version)" IncludeMinimum="no" OnlyDetect="yes" Language="1033" Property="NEWPRODUCTFOUND" />

        <!-- Detect and remove any older version of this product-->
        <UpgradeVersion Maximum="$(var.version)" IncludeMaximum="yes" OnlyDetect="no" Language="1033" Property="OLDPRODUCTFOUND" />
    </Upgrade>
    <CustomAction Id="PreventDowngrading" Error="Newer version already installed"></CustomAction>
    <InstallExecuteSequence>
        <!-- Prevent Downgrading-->
        <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
        <RemoveExistingProducts After="InstallInitialize" />
    </InstallExecuteSequence>
    <InstallUISequence>
        <!-- Prevent Downgrading-->
        <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
    </InstallUISequence>

What does your <RemoveExistingProducts After=""> step look like? It could be that the removeexisting is running after the install -- and removing all files that were the same in the previous and current versions.

I have my installer set to <RemoveExistingProducts After="InstallInitialize"> to make sure it's done before anything else. I don't know if it's right or not, but it seems to work.

    <Upgrade Id="$(var.UpgradeCode)">
        <!--Upgrade code found at http://www.nichesoftware.co.nz/blog/200809/upgradable-msi-installations-with-wix -->
        <!-- Detect any newer version of this product-->
        <UpgradeVersion Minimum="$(var.version)" IncludeMinimum="no" OnlyDetect="yes" Language="1033" Property="NEWPRODUCTFOUND" />

        <!-- Detect and remove any older version of this product-->
        <UpgradeVersion Maximum="$(var.version)" IncludeMaximum="yes" OnlyDetect="no" Language="1033" Property="OLDPRODUCTFOUND" />
    </Upgrade>
    <CustomAction Id="PreventDowngrading" Error="Newer version already installed"></CustomAction>
    <InstallExecuteSequence>
        <!-- Prevent Downgrading-->
        <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
        <RemoveExistingProducts After="InstallInitialize" />
    </InstallExecuteSequence>
    <InstallUISequence>
        <!-- Prevent Downgrading-->
        <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
    </InstallUISequence>
酒绊 2024-07-22 05:44:40

我知道这是一个较旧的线程,但我遇到了解决方案未涵盖的类似问题。 就我而言,我有一个 DLL,它的版本号实际上比它的前身版本低。 此 DLL 永远不会出现在升级安装中。 运行

msiexec /i myproduct.msi /l*vx install2.log

并检查日志表明该文件从未安装。 它只是没有作为安装的文件之一出现在日志中。 MSI 肯定包含该文件,最好的证据是修复会放置该文件。 此外,使用各种工具分解 MSI 显示了该文件的存在。 直接安装在干净的机器上总是可以的。

这没有帮助:

msiexec /i myproduct.msi REINSTALL=ALL REINSTALLMODE=amus /l*vx install3.log

我正在使用 Wix 构建 MSI,并且我已经使用这个脚本很多年了。 最近我们在 5.3 版本中设置了脚本来完全删除旧目录。 这已经工作到 5.2 -> 了。 5.3和5.3→ 5.4 升级。 但在 5.5 版本中,DLL 全部用新版本的 DLL 重新构建。 DLL 项目托管在 GitHub 中。 该特定 DLL 的构建脚本被设置为“10.0.0.{git rev-list --count HEAD}”的汇编版本。 该项目已被移动,导致 HEAD 计数从 444 变为 30。wixscript

包含此内容,

define ProductGuid = "{nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn}"

因此我们在每个版本上更新产品 guid(而不是产品升级 guid)。

补救措施是稍微更改此 dll 的构建脚本,将程序集版本设置为“10.0.1.{git rev-list --count HEAD}”,大概被视为更高版本编号版本。

为什么这有效,我无法解释。

I know this is an older thread, but I encountered a similar problem that was not covered by the solutions. In my case, I had a DLL that was actually a lower number version than its predecessor. This DLL would never appear on an upgrade install. Running

msiexec /i myproduct.msi /l*vx install2.log

and checking the log showed that the file never was installed. It just did not appear in the log as one of the files installed. The MSI definitly contained the file, the best evidence being that a Repair would place the file. Also, exploding the MSI with various tools showed the file present. A straight install on a clean machine would always work.

This did not help:

msiexec /i myproduct.msi REINSTALL=ALL REINSTALLMODE=amus /l*vx install3.log

I am building the MSI with Wix, and I have been using this script for many years. Most recently we set the script to completely delete the old directory in our 5.3 version. This had worked to 5.2 -> 5.3 and 5.3 -> 5.4 upgrades. But with the 5.5 version, the DLLs were all rebuilt with new versions of the DLLs. The DLL projects were hosted in GitHub. The build script for this particular DLL was set to be an assembly version of '10.0.0.{git rev-list --count HEAD}'. The project had been moved, causing the HEAD count to go from 444 to 30.

The wixscript include has this,

define ProductGuid = "{nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn}"

so we update the product guid (not the product upgrade guid) on each release.

The remedy was to slightly change the build script of this dll to set the assembly version to go to '10.0.1.{git rev-list --count HEAD}', presumably being treated as a higher numbered version.

Why this worked, I am unable to explain.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文