Wix:如何警告用户而不是使用属性终止安装? [英] Wix: How to warn user instead of terminating installation using Properties?

查看:22
本文介绍了Wix:如何警告用户而不是使用属性终止安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 x64 计算机上搜索 Microsoft Access 数据库引擎的注册表项.这是我的代码:

I'm searching for registry keys for Microsoft Access Database Engine on x64 machine. Here is my code:

  <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>

现在,用户将看到一条消息,安装将退出.

Now here, user is presented with a message and installation will quit.

问题:如何防止安装终止并向用户显示警告消息,然后继续安装?

Question: How would I prevent the Termination of installation and present the user with h a warning message instead, and installation would continue?

谢谢并致以最诚挚的问候.

Thanks and best regards.

推荐答案

我发现最好的方法是创建一个带有警告消息的自定义对话框.我喜欢使用 WixEdit 来调整预先存在的对话框.

The best way I've found to do it is to create a custom dialog box with the warning message. I like to use WixEdit to tweak a pre-existing dialog.

<?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>

然后我们根据条件安排它

Then we schedule it based on a condition

<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>

这篇关于Wix:如何警告用户而不是使用属性终止安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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