如何防止Wix安装旧版本? [英] How to prevent Wix from installing an older version?

查看:121
本文介绍了如何防止Wix安装旧版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要切换到WiX安装程序的应用程序.到目前为止,几乎所有事情似乎都进展顺利.我遇到的一个问题是,如果下载了较旧的版本并尝试安装,则会这样做.

这有点问题.如果安装了较新的版本,我不希望它安装较旧的版本.我以为问题出在升级"组件上,但我必须承认我碰壁了.如何更改它,以便较旧的版本看到已经安装了一个较新的版本,而不安装它?

我的测试产品现在是2.4版(我们正在尝试推出的最新版本).它可以正确升级到2.4.1或2.5或3.0.但是,如果我制作了3.0版本,然后为2.4运行了msi,它仍然会添加它.

我的升级组件:

<Upgrade Id="PUT-GUID-HERE">
  <UpgradeVersion Maximum="2.4" Property="PREVIOUSVERSIONSINSTALLED" />
  <UpgradeVersion Minimum="1.0" Property="NEWERPRODUCTFOUND" OnlyDetect="yes" IncludeMinimum="no" />
</Upgrade>

跟进:
在遵循斯坦斯的建议后,我得到了这样的错误
找到重复的符号'WixAction:InstallExecuteSequence/RemoveExistingProducts'"
<InstallExecuteSequence>下的Product.wxs文件中浏览后,我不得不删除<RemoveExistingProducts Sequence="6550" />,因为那是它所指的重复项.完成此操作后,安装程序将运行,并且旧版本无法再安装在新版本之上.

解决方案

过去的期货软件包 :您不能更改软件包的旧版本来检测较新的软件包.您需要从一开始就在您的程序包中建立保护. Packages need to be pre-cognitive. It's an industry problem.

现代时代 :您上面显示的WiX元素是旧样式".此处介绍了一个新的便利功能": MajorUpgrade元素具有一些自动魔术性,我相信它会默认添加您描述的保护(降级保护).因此,您可以切换到使用它.我会先尝试.让我内联基本标记:

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

除了删除旧的升级元素外,还请记住删除RemoveExistingProducts标准操作的所有硬编码调度.例如,删除此行(序列号可能会有所不同,但名称相同):

<RemoveExistingProducts Sequence="6550" />


去耦 :如果您发现人们将运行较旧版本并与最新应用程序混淆的可能性很高,则可以设置一个新的安装位置,然后为您的最新版本提供新的升级代码,并并排安装以使旧产品和新产品脱钩.

并排 :要使其正常工作,您的产品必须能够和平共存,并且不能为每台机器争用文件关联注册的COM服务器,或使产品相互干扰的其他全局共享数据.是否可行取决于您的应用程序.不能从两个不同的位置注册全局共享的COM服务器-如果您使用普通的注册表注册(尽管有时会涉及基于清单的无reg的COM,但是您可以使用基于清单的COM).在您的应用程序支持并行安装之前,可能需要克服许多挑战,或者,如果您的程序包很简单且没有注册表的参与,那么这可能就很简单了.

组件GUID :除了提到的升级代码更改之外,您还需要为所有组件设置新的组件GUID,以真正屏蔽产品彼此.如果您使用 WiX自动GUID ,则会自动神奇地发生.尝试尝试使用新组件GUID的原因在这里解释:更改我的组件GUID在wix中?本质上,GUID引用计算的是绝对安装位置,而不是文件本身.安装到新位置,需要新的组件GUID.

I have an application that we are switching over to a WiX installer. So far almost everything seems to be going well. The one problem I'm having is that if an older version is downloaded and attempted to install, it does so.

And that's a bit of a problem. If there is a newer version installed I don't want it to install the older version. I thought the problem was with the "Upgrade" component but I must admit I've hit a wall. How can I change it so that the older versions see there is a newer version already installed and not install it?

My test product is now in version 2.4 (the newest version we're trying to push out). It upgrades correctly to 2.4.1 or 2.5 or 3.0. But if I make a 3.0 version, and then run the msi for 2.4 it still adds it.

My upgrade component:

<Upgrade Id="PUT-GUID-HERE">
  <UpgradeVersion Maximum="2.4" Property="PREVIOUSVERSIONSINSTALLED" />
  <UpgradeVersion Minimum="1.0" Property="NEWERPRODUCTFOUND" OnlyDetect="yes" IncludeMinimum="no" />
</Upgrade>

Follow Up:
After following Steins suggestion I got an error like this
"Duplicate symbol 'WixAction:InstallExecuteSequence/RemoveExistingProducts' found"
After looking around in the Product.wxs file under the <InstallExecuteSequence>I had to delete <RemoveExistingProducts Sequence="6550" /> because that was the duplicate it was referring to. After doing that the installer worked and old versions can no longer be installed on top of new versions.

解决方案

Packages of Futures Past: You can not change older versions of your package to detect newer ones. You need to build protection into your packages from the start. Packages need to be pre-cognitive. It's an industry problem.

Modern Times: The WiX elements you show above are "old-style". There is a new "convenience feature" described here: How do you detect installed product versions at each startup? It involves the "new" MajorUpgrade element. This new MajorUpgrade element features some auto-magic and I believe it adds the protection you describe by default (downgrade protection). Hence you can switch to using it. I would try that first. Let me inline the basic markup:

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

In addition to removing the old-style upgrade elements, please also remember to delete any hard coded scheduling of the RemoveExistingProducts standard action. For example, remove this line (sequence number will likely be different, but same name):

<RemoveExistingProducts Sequence="6550" />


Decoupling: If you find that there is a high risk that people will run the older versions and mess with your newest application, you could set a new installation location and a new upgrade code for your latest version and install side-by-side to decouple your old and new products.

Side-By-Side: For this to work your product(s) must be capable of co-existing peacefully and not fight over file associations, per-machine registered COM servers, or other globally shared data that make the products interfere with each other. Whether this is possible or not depends on your application. A globally shared COM server can not be registered from two different locations - if you use normal registry registration (you can use manifest based reg-free COM though - though this is involved at times). There can be many challenges to overcome before your application supports side-by-side installation, or it could be rather trivial if your package is simple with no registry involvement.

Component GUIDs: You need to set new component GUIDs as well - for all components - in addition to the mentioned change of upgrade code in order to really shield the products from each other. If you use WiX auto-GUIDs this will happen auto-magically. The reason you need new component GUIDs is attempted explained here: Change my component GUID in wix? Essentially a GUID reference counts an absolute installation location, not a file per-se. You install to a new location, you need a new component GUID.

这篇关于如何防止Wix安装旧版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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