Wix:如果找到以前的版本,则显示自定义对话框 [英] Wix: show custom dialog if previous version found
问题描述
我想自定义我的安装程序以在已安装以前的版本时显示自定义对话框:在欢迎对话框之后,用户应该看到一个自定义对话框 OldVersionDlg
,其中包含已找到以前版本并将自动卸载的信息.
I want to customize my installer to show custom dialog when previous version is already installed: after Welcome dialog user should see a custom dialog OldVersionDlg
with information that previous version was found and will be uninstalled automatically.
但是由于某种原因,当我在 UI/Publish Dialog
中检查它的条件时,UpgradeVersion
元素设置的属性总是 null
.
But for some reason property set by UpgradeVersion
element always null
when I check it in condition in UI/Publish Dialog
.
这里是基本的代码片段.
Here are essential code snippets.
Product.wxs:
<Product Id="*" Version="$(var.Version)" UpgradeCode="$(var.ProductId)"
Language="1033" Name="$(var.ProductFullName)" Manufacturer="$(var.Manufacturer)">
<Package Description="$(var.ProductDescription)" InstallerVersion="200" Compressed="yes"
Manufacturer="$(var.Manufacturer)" />
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="$(var.ProductId)">
<UpgradeVersion Minimum="1.0.0.0" Maximum="$(var.Version)"
Property="PREVIOUSVERSIONSINSTALLED"
IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>
<InstallExecuteSequence>
<RemoveExistingProducts Before="InstallInitialize" />
</InstallExecuteSequence>
</Product>
WixUI_Wizard.wxs:
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="OldVersionDlg">PREVIOUSVERSIONSINSTALLED</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg">NOT Installed</Publish>
下一步按钮不起作用.我检查了在 FindRelatedProducts
之后设置了 PREVIOUSVERSIONSINSTALLED
的日志.如果我在 Product.wxs 的条件下使用它,则一切正常.但是在 UI 配置中它总是 null
.
The button Next doesn't work.
I've checked in logs that PREVIOUSVERSIONSINSTALLED
is set after FindRelatedProducts
. If I use it in conditions in Product.wxs then everything is OK. But in UI configuration it is always null
.
感谢您的帮助.
推荐答案
问题是由 WixUI_Wizard.wxs 中的第二行引起的.出于某种原因,WiX 总是使用它.因此,要实现对先前版本的检查,我们需要从第二个条件中排除 PREVIOUSVERSIONSINSTALLED
:
The problem was caused by the second line in WixUI_Wizard.wxs. For some reason WiX always uses it. So, to implement checking of previous version we need to exclude PREVIOUSVERSIONSINSTALLED
from the second condition:
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="OldVersionDlg">PREVIOUSVERSIONSINSTALLED</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg">NOT Installed AND NOT PREVIOUSVERSIONSINSTALLED</Publish>
这篇关于Wix:如果找到以前的版本,则显示自定义对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!