您如何在每次启动时检测已安装的产品版本? [英] How do you detect installed product versions at each startup?

查看:169
本文介绍了您如何在每次启动时检测已安装的产品版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,这个问题是为了避免我不会解决的问题

This problem, in fact, is to avoid a problem I will not solve

当我安装产品一次并再次使用MSI时,将执行卸载过程. 但是,这不会从注册表中删除残留信息,必须使用"Windows Installer清理"清理这些残留信息,并且在重新安装时,会出现注册表权限问题.

When I install my product once and I use the MSI again, the unloading process is performed. However, this does not remove residual information from the registry, which must be cleaned Up using "Windows Installer Clean Up", and when reinstalled, a registry permission issue occurs.

我看到了正在检查老歌,但是,发现FindRelatedProducts仅在首次安装时执行,也就是说,当我再次安装MSI时,FindRelatedProducts没有执行.

I saw the Checking for Oldies, However, it was found that FindRelatedProducts only performed on the first installation, that is, when I installed the MSI again, FindRelatedProducts did not.

<Upgrade Id='YOURGUID-7349-453F-94F6-BCB5110BA4FD'>
<UpgradeVersion OnlyDetect='yes' Property='SELFFOUND'
    Minimum='1.0.1' IncludeMinimum='yes'
    Maximum='1.0.1' IncludeMaximum='yes' />
<UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND'
    Minimum='1.0.1' IncludeMinimum='no' />
</Upgrade>

<CustomAction Id='AlreadyUpdated' Error='Foobar 1.0 has already been updated to 1.0.1 or newer.' />

<InstallExecuteSequence>
    <Custom Action='AlreadyUpdated'     After='FindRelatedProducts'>SELFFOUND</Custom>
    <Custom Action='NoDowngrade' After='FindRelatedProducts'>NEWERFOUND</Custom>
</InstallExecuteSequence>

所以我想问你们 安装MSI后,如何在每次运行MSI时进行检查?是否已安装并具有相同的版本,如果已安装相同的版本,请退出安装过程.

So I'd like to ask you guys How do I check every time I run MSI when I have installed it? Is it installed and the same version, If the same version has been installed, exit the installation process.

推荐答案

MSI切换 :我不确定您到底做了什么-您似乎已经切换了已安装的MSI-完全不建议这样做.它可能会导致严重的问题-注册表中甚至包括全部MSI数据库损坏.

MSI Zapping: I am not sure what exactly you have done - you seem to have zapped your installed MSI - which is not recommended at all. It can cause serious problems - up to and including total MSI database corruption in the registry.

但是,首先要注意的是:

However, first things first:

主要升级元素 :您可以使用更方便的旧-Style升级元素正在使用中.下面是更现代的MajorUpgrade convenience element的示例:

MajorUpgrade Element: You can use the more convenient MajorUpgrade Element instead of the older-style elements you are using. Here are the older-Style Upgrade Elements in use. Directly below is a sample of the more modern, MajorUpgrade convenience element in action:

<MajorUpgrade Schedule="afterInstallInitialize" 
              DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." 
              AllowDowngrades="no" AllowSameVersionUpgrades="no" />

也许尝试使用此元素,而不要使用您正在使用的元素.只需注释掉旧的,然后替换为这个简单的元素即可.如果正确执行此操作,则主要升级应开箱即用".确保在产品中指定 UpgradeCode 元素.请参阅有关重大升级的文档

Maybe try this element instead of those you are using. Just comment the old ones out and replace with this simple element. If you do this correctly your major upgrade should work "out of the box". Make sure you specify an UpgradeCode in the Product Element. See the documentation for major upgrades

相关链接:

  • How to implement WiX installer upgrade?
  • Upgrading a WiX generated package with major version zero
  • How to implement WiX installer upgrade?

我没有完全理解您的问题的这一部分 :"当我安装产品一次并再次使用MSI时,将执行卸载过程.但是,这不会从注册表中删除残留信息,必须使用"Windows Installer清理"清理这些残留信息,并且在重新安装时,会发生注册表权限问题".

  • 快速移动 :您到底做了什么?破坏安装?为什么?您应该能够从Add / Remove programs成功卸载吗?卸载失败了吗?重新安装时出现什么错误消息?
  • 修改/修复 :MSI会自动检测何时已将其安装在相同版本中.然后,您将看到安装程序的修改/修复"对话框,而不是首次安装对话框.
    • 仅当您双击用于安装的原始MSI文件而不重建它时,才会显示这些修改对话框.或者您从添加/删除程序"中调用修改.
    • 如果重新构建安装程序,它将至少具有一个新的程序包GUID,然后MSI将检测到新构建的MSI不是已安装的MSI,并显示一条错误消息.现在,您可以从添加/删除程序"中卸载当前版本.
    • Zapping: What exactly did you do? Zap the installation? Why? You should be able to successfully uninstall from Add / Remove programs? Did that uninstall fail? What is the error message on reinstall?
    • Modify / Repair: MSI will detect when it is already installed in the same version auto-magically. You will then see the setup's modify / repair dialog show up, and not the first time installation dialogs.
      • These modify dialogs only show up if you double click the original MSI files used to install, without rebuilding it. Or you invoke modify from Add / Remove Programs.
      • If you rebuild your setup, it will have a new package GUID at the very least, and MSI will then detect that the freshly built MSI is not the one that is already installed, and an error message shows up. Now you can uninstall the current version from Add / Remove programs.
      • 如果您每次编译都生成一个新产品GUID,则除非您编写升级表,否则您可以在较旧的安装中并置"或并排"安装新版本.在这种情况下,旧版本应作为新版本安装的一部分自动卸载.

      您需要了解包装代码,产品代码和升级代码.包代码是为每个编译和构建自动生成的.您可以通过在product元素中将其设置为*来设置自动生成的产品代码,也可以对其进行硬编码并根据需要进行更改.定义后,升级代码应保持不变.请谷歌搜索这些不同代码之间的区别-我现在没有时间总结这个解释.

      You need to understand package code, product code and upgrade code. The package code is auto-generated for every compile and build. The product code you can set to auto-generate by setting it to * in the product element, or you can hard code it and change it as required. The upgrade code should stay the same once defined. Please google the difference between these different codes - I don't have time to wrap up this explanation right now.

      这篇关于您如何在每次启动时检测已安装的产品版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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