如何使用 wix 工具集跳过 msi 的 PIDKey 要求?

How to skip PIDKey requirement for msi, using wix toolset?

我正在使用 wix 工具集创建 msi 安装程序。我需要用户输入,所以我使用 UI 文档中的对话框:https://www.firegiant.com/wix/tutorial/user-interface/new-link-in-the-chain/

在 link 所示的示例中,我删除了 CDKeyEdit

<Control Id="CDKeyEdit" Type="MaskedEdit" X="45" Y="159" Width="250" Height="16" Property="PIDKEY" Text="[PIDTemplate]" />

因为我的申请不需要。

但是,安装程序在安装过程中显示密钥无效:

有什么方法可以删除 PIDKey 的要求吗?

QA: Please remember to test in all installation modes: install, uninstall, modify, repair, self-repair, patching, major upgrade, etc.... Hard to tell how things can conspire, no substitute for real-world testing (just to state the obvious).


UserRegistrationDlg.wxs:限于不测试,这里建议UserRegistrationDlg.wxs:

<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Fragment>
    <UI>
      <Dialog Id="UserRegistrationDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
        <Control Id="NameLabel" Type="Text" X="45" Y="73" Width="100" Height="15" TabSkip="no" Text="&amp;User Name:" />
        <Control Id="NameEdit" Type="Edit" X="45" Y="85" Width="220" Height="18" Property="USERNAME" Text="{80}" />
        <Control Id="OrganizationLabel" Type="Text" X="45" Y="110" Width="100" Height="15" TabSkip="no" Text="&amp;Organization:" />
        <Control Id="OrganizationEdit" Type="Edit" X="45" Y="122" Width="220" Height="18" Property="COMPANYNAME" Text="{80}" />
        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
          <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
        </Control>
        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
          <Publish Event="NewDialog" Value="SetupTypeDlg">1</Publish>
        </Control>
        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
          <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
        </Control>
        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
          <Text>Please enter your customer information</Text>
        </Control>
        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
          <Text>{\WixUI_Font_Title}Customer Information</Text>
        </Control>
        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
      </Dialog>
    </UI>
  </Fragment>
</Wix>

更改的快速说明:仅更改了一些内容。

取出CD-Key的实际控件:

<Control Id="CDKeyLabel" Type="Text" X="45" Y="147" Width="50" Height="10" TabSkip="no">
    <Text>CD &amp;Key:</Text>
</Control>
<Control Id="CDKeyEdit" Type="MaskedEdit" X="45" Y="159" Width="250" Height="16" Property="PIDKEY" Text="[PIDTemplate]" />

并删除控件的关联事件:

<Publish Event="ValidateProductID" Value="0">1</Publish>
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">CostingComplete = 1</Publish>

最后将对话框中下一步按钮的 ProductID 条件更改为 1 以便生成了一个新对话框并且未验证密钥:

<Publish Event="NewDialog" Value="SetupTypeDlg">1</Publish>
  <Publish Event="ValidateProductID" Value="0">1</Publish>
  <Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">CostingComplete = 1</Publish>
  <Publish Event="NewDialog" Value="SetupTypeDlg">ProductID</Publish>

寻找这些并删除第一个并将最后一个的条件更改为空或 1。

无耻插件:看看我的开源工具IsWiX。它提供模板和设计器以更快地学习和使用 WiX。

教程在这里:

https://github.com/iswix-llc/iswix-tutorials

要包含一个新的自定义对话框,您只需取消注释一行,如下所示:

https://github.com/iswix-llc/iswix-tutorials/blob/master/desktop-application/Installer/DesktopApplication/Code/UI.wxs

此处显示了新对话框的代码:

https://github.com/iswix-llc/iswix-tutorials/blob/master/desktop-application/Installer/DesktopApplication/Code/UI-CustomDialog.wxs