2014-03-07 51 views
0

我正在嘗試使用Wix將InstallScopeDlg添加到我的安裝程序中。由於InstallScopeDlg僅在WixUI_Advanced中可用,但我不需要該UI中的其他對話框,因此我決定通過複製WixUI_Minimal代碼並將其重命名爲WixUI_MyMinimal來創建自己的UI。然後我改變了一些序列和按鈕名稱,所以我可以在WelcomeEulaDlg之後和ProgressDlg之前放置InstallScopeDlg。我還將其他所需的對話框複製到Visual Studio中的Wix項目中。
界面顯示正確,但InstallScopeDlg上的「下一步」按鈕不起作用,並且顯示ProgressDlg而沒有執行任何操作。Wix UI自定義:將InstallScopeDlg添加到WixUI_Minimal

1 - 這是一個正確的解決方案,添加InstallScopeDlg
2 - 我該如何解決這個問題?

以下是WixUI_MyMinimal

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
<Fragment> 
    <WixVariable Id="WixUISupportPerUser" Value="1" Overridable="yes" /> 
    <WixVariable Id="WixUISupportPerMachine" Value="1" Overridable="yes" /> 
    <PropertyRef Id="ApplicationFolderName" /> 

    <CustomAction Id="WixSetDefaultPerUserFolder" Property="WixPerUserFolder" Value="[LocalAppDataFolder]Apps\[ApplicationFolderName]" Execute="immediate" /> 
    <CustomAction Id="WixSetDefaultPerMachineFolder" Property="WixPerMachineFolder" Value="[ProgramFilesFolder][ApplicationFolderName]" Execute="immediate" /> 
    <CustomAction Id="WixSetPerUserFolder" Property="APPLICATIONFOLDER" Value="[WixPerUserFolder]" Execute="immediate" /> 
    <CustomAction Id="WixSetPerMachineFolder" Property="APPLICATIONFOLDER" Value="[WixPerMachineFolder]" Execute="immediate" /> 

    <InstallExecuteSequence> 
     <Custom Action="WixSetDefaultPerUserFolder" Before="CostFinalize" /> 
     <Custom Action="WixSetDefaultPerMachineFolder" After="WixSetDefaultPerUserFolder" /> 
     <Custom Action="WixSetPerUserFolder" After="WixSetDefaultPerMachineFolder">ACTION="INSTALL" AND APPLICATIONFOLDER="" AND (ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged)))</Custom> 
     <Custom Action="WixSetPerMachineFolder" After="WixSetPerUserFolder">ACTION="INSTALL" AND APPLICATIONFOLDER="" AND (ALLUSERS=1 OR (ALLUSERS=2 AND Privileged))</Custom> 
    </InstallExecuteSequence> 


    <UI Id="WixUI_MyMinimal"> 
     <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="myWixUI_Mode" Value="InstallCustom" /> 

     <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="WelcomeDlg" /> 
     <DialogRef Id="WelcomeEulaDlg" /> 
     <DialogRef Id="InstallScopeDlg"/> 

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

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

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

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

     <Publish Dialog="InstallScopeDlg" Control="Next" Property="WixAppFolder" Value="WixPerUserFolder" Order="1">!(wix.WixUISupportPerUser) AND NOT Privileged</Publish> 
     <Publish Dialog="InstallScopeDlg" Control="Next" Property="ALLUSERS" Value="{}" Order="2">WixAppFolder = "WixPerUserFolder"</Publish> 
     <Publish Dialog="InstallScopeDlg" Control="Next" Property="ALLUSERS" Value="1" Order="3">WixAppFolder = "WixPerMachineFolder"</Publish> 
     <Publish Dialog="InstallScopeDlg" Control="Next" Property="APPLICATIONFOLDER" Value="[WixPerUserFolder]" Order="4">WixAppFolder = "WixPerUserFolder"</Publish> 
     <Publish Dialog="InstallScopeDlg" Control="Next" Property="APPLICATIONFOLDER" Value="[WixPerMachineFolder]" Order="5">WixAppFolder = "WixPerMachineFolder"</Publish> 
     <Publish Dialog="InstallScopeDlg" Control="Next" Event="NewDialog" Value="ProgressDlg" Order="6">WixAppFolder = "WixPerUserFolder"</Publish> 
     <Publish Dialog="InstallScopeDlg" Control="Next" Event="NewDialog" Value="ProgressDlg" Order="7">WixAppFolder = "WixPerMachineFolder"</Publish> 

     <Publish Dialog="InstallScopeDlg" Control="Back" Event="NewDialog" Value="WelcomeEulaDlg" Order="2">1</Publish> 

     <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="WelcomeEulaDlg" Order="2">!(wix.WixUISupportPerMachine) AND !(wix.WixUISupportPerUser)</Publish> 
     <Publish Dialog="WelcomeEulaDlg" Control="Install" Event="NewDialog" Value="InstallScopeDlg" Order="2">!(wix.WixUISupportPerMachine) AND !(wix.WixUISupportPerUser)</Publish> 
     <Publish Dialog="WelcomeEulaDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">1</Publish> 
     <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">1</Publish> 

     <InstallUISequence> 
      <Show Dialog="WelcomeDlg" Before="WelcomeEulaDlg">Installed AND PATCH</Show> 
      <Show Dialog="WelcomeEulaDlg" Before="InstallScopeDlg">NOT Installed</Show> 
      <Show Dialog="InstallScopeDlg" Before="ProgressDlg">NOT Installed</Show> 
      <Custom Action="WixSetDefaultPerUserFolder" Before="CostFinalize" /> 
      <Custom Action="WixSetDefaultPerMachineFolder" After="WixSetDefaultPerUserFolder" /> 
      <Custom Action="WixSetPerUserFolder" After="WixSetDefaultPerMachineFolder">ACTION="INSTALL" AND APPLICATIONFOLDER="" AND (ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged)))</Custom> 
      <Custom Action="WixSetPerMachineFolder" After="WixSetPerUserFolder">ACTION="INSTALL" AND APPLICATIONFOLDER="" AND (ALLUSERS=1 OR (ALLUSERS=2 AND Privileged))</Custom> 

     </InstallUISequence> 

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

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

回答

1

看看我的開源項目ISWIX(CodePlex上)的代碼。它包含一個多項目解決方案模板,其中包含一個用於構建MSI的項目。它添加了對WiXUI的引用,並使用一系列片段來引用內置的對話框集,然後再添加一個引用以將自定義對話框插入到集合中。這是通過將Publish元素(DoAction ControlEvents)添加到相鄰對話框的Next和Back按鈕來完成的。所有這些都是以儘可能接近繼承的方式實現的。

http://iswix.codeplex.com/SourceControl/latest#main/Source/Application/IsWiXAddIn/MSISolutionTemplate/SetupProjectTemplate/UI.wxs

http://iswix.codeplex.com/SourceControl/latest#main/Source/Application/IsWiXAddIn/MSISolutionTemplate/SetupProjectTemplate/UI-CustomDialog.wxs

而且,非常肯定你真的要支持每個用戶安裝。他們是一個痛苦的交易,只有在有限的情況下才有價值。

http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Add-install-InstallScopeDlg-to-WixUI-InstallDir-wxs-td7588647.html

+0

PainterAll自定義對話框在下一步和上一步buttons.Except的installScopeDlg工作.. !!!如何使用此InstallScopeDlg ..? – Arshad