Wix自定义对话框错误2856

时间:2017-02-20 13:46:29

标签: wix

我在安装中添加了自定义对话框的wix安装: ProgramDataInstallDlg

这是整个项目的UI标签:

<UI Id="my_UI">
  <UIRef Id="WixUI_FeatureTree" />
  <DialogRef  Id="ProgramDataInstallDlg" />

  <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ProgramDataInstallDlg">1</Publish>
  <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ProgramDataInstallDlg">1</Publish>
</UI>

如果仅按下下一步,一切正常。但是如果在VerifyReadyDlg中按下后退按钮,或者按下CustomizeDlg中的下一个按钮。我收到错误2856。

这是安装日志所说的内容:

DEBUG: Error 2856:  Creating a second copy of the dialog ProgramDataInstallDlg
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2856. The arguments are: ProgramDataInstallDlg, , 
MSI (c) (E0:6C) [14:06:34:526]: Product: MOPS 4.0 -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2856. The arguments are: ProgramDataInstallDlg, , 

怎么了?

EDIT ProgramDataInstallDlg:

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

          <!--Banner UI-components-->
          <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="Custom Setup" />
          <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="text" />
          <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
          <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />

          <!--Content Components-->

          <Control Id="NameLabel" Type="Text" X="45" Y="73" Width="220" Height="15" TabSkip="no" Text="text" />       


          <!--Bottom UI-components-->
          <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
          <Control Id="Back" Type="PushButton" X="173" Y="243" Width="56" Height="17" Text="Back">
            <Publish Event="SpawnDialog" Value="CustomizeDlg">1</Publish>
          </Control>          
          <Control Id="Next" Type="PushButton" X="230" Y="243" Width="56" Height="17" Default="yes" Text="Next">
            <Publish Event="SpawnDialog" Value="VerifyReadyDlg">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>

        </Dialog>
      </UI>
  </Fragment>
</Wix>

1 个答案:

答案 0 :(得分:1)

如果您要自定义UI,我建议您创建自定义WixUI_FeatureTree。

看看下面的代码。我使用了默认模板并在适当的位置使用了对话框名称。

从自定义对话框中删除以下行:

<Publish Event="SpawnDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Event="SpawnDialog" Value="CustomizeDlg">1</Publish>

主对话框:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <UI Id="WixUI_FeatureTreeCustom">
            <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="FeatureTree" />

            <DialogRef Id="ErrorDlg" />
            <DialogRef Id="FatalError" />
            <DialogRef Id="FilesInUse" />
            <DialogRef Id="MsiRMFilesInUse" />
            <DialogRef Id="PrepareDlg" />
            <DialogRef Id="ProgressDlg" />
            <DialogRef Id="ResumeDlg" />
            <DialogRef Id="UserExit" />
            <DialogRef Id="ProgramDataInstallDlg" />

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

            <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed</Publish>
            <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>

            <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
            <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg">LicenseAccepted = "1"</Publish>

            <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">Installed</Publish>
            <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg" Order="2">NOT Installed</Publish>
            <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ProgramDataInstallDlg">1</Publish>

            <Publish Dialog="ProgramDataInstallDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
            <Publish Dialog="ProgramDataInstallDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg">1</Publish>

            <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ProgramDataInstallDlg" Order="1">NOT Installed OR WixUI_InstallMode = "Change"</Publish>
            <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
            <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3">Installed AND PATCH</Publish>

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

            <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">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>
        </UI>

        <UIRef Id="WixUI_Common" />
    </Fragment>
</Wix>