如何使用Wix工具集跳过MSI的PIDKey要求?

时间:2019-05-17 09:32:38

标签: wix windows-installer

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

在链接中显示的示例中,我删除了Singleton class typedef void (CALLBACK * PortListCallback_t)(void *, ptrConstCComPortInfo_t); . . . void CCommsMgr::listPorts(void *pObj, PortListCallback_t cb) { PortInfoSetConstIter_t i; for (i = m_setPorts.begin(); i != m_setPorts.end(); i++) { cb(pObj, *i); } } Dialog Class static void CALLBACK getPorts(void *obj, ptrConstCComPortInfo_t port); . . . void CALLBACK CMFC_iTFTPDlg::getPorts(void *obj, ptrConstCComPortInfo_t port) { CMFC_iTFTPDlg *pThis = (CMFC_iTFTPDlg*)obj; // do something with it }

CDKeyEdit

因为我的申请没有必要。

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

有什么方法可以取消对<Control Id="CDKeyEdit" Type="MaskedEdit" X="45" Y="159" Width="250" Height="16" Property="PIDKEY" Text="[PIDTemplate]" /> 的要求?

2 个答案:

答案 0 :(得分:1)

  <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

答案 1 :(得分:0)

  

质量检查 :请记住要在所有安装模式下进行测试: install uninstall < / strong>, modify repair self-repair {{1} } patching major upgrade 。很难说出事情如何共谋,不能替代现实世界的测试(只是为了说明显而易见的事实)。


UserRegistrationDlg.wxs :仅限于未测试,但这是对 etc... 的建议:

UserRegistrationDlg.wxs

快速更改说明 :只有几处更改。

取出CD-Key的实际控件:

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

并删除控件的关联事件:

<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