在Wix中更改WixUI_Minimal的对话框序列

时间:2015-01-22 06:01:48

标签: wix windows-installer

我正在创建Wix安装程序,它将创建应用程序池,虚拟目录并为虚拟目录执行一些其他设置。现在,在创建虚拟目录之前,我想显示一个对话框,从用户那里获取用户名和密码,并在App Pool中设置它。安装程序已使用WixUI_Minimal显示许可协议和进度屏幕。我想在许可证屏幕后显示我的自定义对话框。 如何更改WixUI_Minimal的内置序列并放置对话框?

下面是我为Wix_Minical对话框集的执行顺序所做的更改的代码。 PoolSettingsDlg是我的对话框。

注意:我使用的是Wix 3.9.1006.0版本

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
 xmlns:ui="http://schemas.microsoft.com/wix/2006/wi"
 xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<!--<Fragment>
<Property Id="Custom_UIMinimalCommon" Value="1" />
<UI Id="WixUI_Minimal">
  <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
  <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
  <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />

  <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
  <Property Id="WixUI_Mode" Value="Minimal" />

  <DialogRef Id="ErrorDlg" />
  <DialogRef Id="FatalError" />
  <DialogRef Id="FilesInUse" />
  <DialogRef Id="MsiRMFilesInUse" />
  <DialogRef Id="PrepareDlg" />
  <DialogRef Id="PoolSettingsDlg"/>
  <DialogRef Id="ProgressDlg" />
  <DialogRef Id="ResumeDlg" />
  <DialogRef Id="UserExit" />
  <DialogRef Id="WelcomeDlg" />
  <DialogRef Id="WelcomeEulaDlg" />

   <Publish Dialog="PoolSettingsDlg" Control="Next" Event="NewDialog" Value="Return" >1</Publish>
  <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>

  <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>

  <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>

  <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
  <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
  <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>

  <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="PoolSettingsDlg">Installed AND PATCH</Publish>
  <Publish Dialog="PoolSettingsDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>
  <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>

  <InstallUISequence>
    <Show Dialog="WelcomeDlg" Before="WelcomeEulaDlg">Installed AND PATCH</Show>
    <Show Dialog="WelcomeEulaDlg" Before="ProgressDlg">NOT Installed</Show>
  </InstallUISequence>

  <Property Id="ARPNOMODIFY" Value="1" />
</UI>

<UIRef Id="WixUI_Common" />

- &GT;     

1 个答案:

答案 0 :(得分:2)

WixUI_Minimal不适合您尝试执行的操作,因为它会显示1个对话框,然后退出向导循环。

更好的方法是建立WixUI_FeatureTree体验。您可以在使用此XML的许可证对话框后插入对话框:

  <!-- Insert into dialog sequencing by inserting control events on previous and next dialogs-->
      <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="YourCustomDlg">1</Publish>
      <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="YourCustomDlg" Order="3">NOT Installed</Publish>

FWIW,我维护了一个名为IsWiX的开源项目。它投影项目视觉工作室项目模板(脚手架),其中包含如下所示的片段:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Fragment>
    <UI Id="UI">
      <!-- See http://wix.sourceforge.net/manual-wix3/WixUI_index.htm for more information-->
      <UIRef Id="WixUI_FeatureTree"/>
      <!--Uncomment to inject a custom dialog into the install wizard loop -->
      <!--<UIRef Id="CustomDlg"/>-->
    </UI>
   </Fragment>
</Wix>

您只需取消注释UIRef行,即可获得一个看起来像这样的附加片段。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Fragment>
    <UI Id="CustomDlg">
      <Dialog Id="CustomDlg" Height="270" Width="370" Title="[ProductName] Setup">

        <!-- Header -->
        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" Text="WixUI_Bmp_Banner"/>
        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Text="{\WixUI_Font_Title}Custom Dialog" Transparent="yes"/>
        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Text="Place your custom description here" Transparent="yes"/>
        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0"/>

        <!-- Body  -->
        <Control Id="CustomLabel" Type="Text" X="20" Y="60" Width="290" Height="15" Text="Customer:" TabSkip="yes"/>
        <Control Id="Custom" Type="Edit" X="20" Y="80" Width="320" Height="18" Property="CUSTOM"/>

        <!-- Footer -->
        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0"/>
        <Control Id="Next" Type="PushButton" Text="&amp;Next" TabSkip="no" Default="yes" Height="17" Width="56" X="236" Y="243">
          <Publish Event="NewDialog" Value="CustomizeDlg"/>
        </Control>
        <Control Id="Cancel" Type="PushButton"  Text="Cancel" TabSkip="no" Height="17" Width="56" X="304" Y="243" Cancel="yes">
          <Publish Event="SpawnDialog" Value="CancelDlg"/>
        </Control>
        <Control Id="Back" Type="PushButton"  Text="&amp;Back" TabSkip="no" Height="17" Width="56" X="180" Y="243">
          <Publish Event="NewDialog" Value="LicenseAgreementDlg"/>
        </Control>

      </Dialog>
      <!-- Insert into dialog sequencing by inserting control events on previous and next dialogs-->
      <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="CustomDlg">1</Publish>
      <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="CustomDlg" Order="3">NOT Installed</Publish>
    </UI>
  </Fragment>
</Wix>

使用IsWiX可以为桌面应用程序,Windows服务和IIS Web应用程序创建基本安装程序,而无需键入任何XML。这对学习曲线非常有帮助。随着技能的提高,您可以通过创作其他XML来进行自定义。