我最近使用的是wix,我想检测办公室是否安装使用wix&如果不是,则显示对话框。 我写了下面的代码,它没有显示对话框。 有什么想法吗?
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" >
<Product Id="*" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="f91c0ad9-0bbd-446d-9869-74801966e922">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
</Product>
<Fragment>
<util:RegistrySearch Id="Path"
Variable="OfficeSearchResult"
Root="HKLM"
Key="SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot"
/>
<InstallUISequence>
<Show Dialog="OfficeWarningDlg" After="ExecuteAction">
<![CDATA[(OfficeSearchResult == "")]]>
</Show>
</InstallUISequence>
<UI>
<Dialog Id="OfficeWarningDlg" Width="284" Height="73" Title="QuickTime Note" NoMinimize="yes">
<Control Id="ctrl_dialog" Type="Text" X="38" Y="8" Width="240" Height="40" TabSkip="no">
<Text>Microsoft office is required.</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>
答案 0 :(得分:1)
难道你不能只使用一个<Condition>
元素,如果不满足条件,它会显示一个小对话框(并中止安装)?然后你可以在你的例子中找到UI
/ InstallUISequence
的东西。
<Wix ...>
<Product ...>
<Package ... />
<Property Id="OFFICEISINSTALLED">
<RegistrySearch Id="OfficeRegistryRegKey"
Root="HKLM" Key="SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot" />
</Property>
<Condition Message="Microsoft office is required to install this product">
<![CDATA[Installed OR OFFICEISINSTALLED]]>
</Condition>
</Product>
</Wix>