我正在x64机器上搜索Microsoft Access数据库引擎的注册表项。这是我的代码:
<Property Id="MS_ADE_X64">
<RegistrySearch Id="MSADEX64_DIR" Root="HKLM" Key="SOFTWARE\Microsoft\Office\14.0\Access Connectivity Engine\InstallRoot" Name="Path" Type="directory" Win64="yes" >
<DirectorySearch Id="MSADE_DIR" Path="[MSADEX64_DIR]" >
<FileSearch Id ="ACECORE_DLL" Name ="ACECORE.DLL" />
</DirectorySearch>
</RegistrySearch>
</Property>
<Condition Message="This application requires Microsoft Access Database Engine (X64). Please install the Microsoft Access Database Engine (X64) then run this installer again.">
<![CDATA[Installed OR MS_ADE_X64]]>
</Condition>
现在,用户会看到一条消息,安装将退出。
问题: 如何阻止安装终止并向用户显示警告消息,并继续安装?
谢谢和最诚挚的问候。
答案 0 :(得分:7)
我发现这样做的最好方法是创建一个带有警告消息的自定义对话框。我喜欢使用WixEdit来调整预先存在的对话框。
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<!-- QuickTime is not installed warning dialog -->
<UI>
<Dialog Id="QtWarningDlg" Width="284" Height="73" Title="QuickTime Note" NoMinimize="yes">
<Control Id="Text" Type="Text" X="38" Y="8" Width="240" Height="40" TabSkip="no">
<Text>QuickTime version 7.5.5 or higher is required for some components to function correctly. You may proceed with installation, but be sure to install QuickTime if you will be using any of those components.</Text>
</Control>
<Control Id="OK" Type="PushButton" X="114" Y="52" Width="56" Height="17" Default="yes" Cancel="yes" Text="OK">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
</Dialog>
</UI>
</Fragment>
</Wix>
然后我们根据条件安排它
<InstallUISequence>
<Custom Action="GetQuickTimeVersion" Before="QtWarningDlg"/>
<!-- Warn if QuickTime is not installed -->
<Show Dialog="QtWarningDlg" After="AppSearch">
<![CDATA[NOT Installed AND ((QUICKTIME_VERSION = "") OR (QUICKTIME_VERSION < "#123043840"))]]>
</Show>
</InstallUISequence>
答案 1 :(得分:3)
我也尝试过,但它不适用于Java Runtime。
将注册表搜索结果分配给属性。
<Property Id="JAVACURRENTVERSION">
<RegistrySearch Id="JRE_KEY" Root="HKLM" Key="SOFTWARE\JavaSoft\Java Runtime Environment" Name="CurrentVersion" Type="raw" />
</Property>
然后使用此属性有条件地显示警告对话框,
<UI>
<Dialog Id="JavaWarningDlg" Width="284" Height="73" Title="Java Runtime" NoMinimize="yes">
<Control Id="Text" Type="Text" X="38" Y="8" Width="240" Height="40" TabSkip="no">
<Text>JRE version 1.6 or higher is required for some components to function correctly. You may proceed with installation, but be sure to install JRE if you will be using any of those components.</Text>
</Control>
<Control Id="OK" Type="PushButton" X="114" Y="52" Width="56" Height="17" Default="yes" Cancel="yes" Text="OK">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
</Dialog>
<InstallUISequence>
<!-- Warn if Java is not installed -->
<Show Dialog="JavaWarningDlg" Before="ResumeDlg">
<![CDATA[NOT Installed AND JAVACURRENTVERSION < "1.6"]]>
</Show>
</InstallUISequence>
</UI>
它并不是在所有情况下工作所以,我用详细的日志进行调查,发现“PrepareDlg”早于属性指定调用,所以我将案例在“= PrepareDlg ”之前切换为Before =“的 ResumeDlg 强>”。
现在工作正常。