Wix UI 自定义:将 InstallScopeDlg 添加到 WixUI_Minimal [英] Wix UI customization: Adding InstallScopeDlg to WixUI_Minimal

查看:20
本文介绍了Wix UI 自定义:将 InstallScopeDlg 添加到 WixUI_Minimal的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Wix 将 InstallScopeDlg 添加到我的安装程序.因为 InstallScopeDlg 仅在 WixUI_Advanced 中可用,但我不需要该 UI 中的其他对话框,所以我决定通过复制 WixUI_Minimal 来创建自己的 UI> 代码并重命名为 WixUI_MyMinimal.然后我更改了一些序列和按钮名称,以便我可以将 InstallScopeDlg 放在 WelcomeEulaDlg 之后和 ProgressDlg 之前.我还将其他所需的对话框复制到我在 Visual Studio 中的 Wix 项目中.
界面显示正确,但 InstallScopeDlg 上的下一步"按钮不起作用,并显示 ProgressDlg 没有做任何事情.

I am trying to add the InstallScopeDlg to my installer using Wix. Because InstallScopeDlg is only available in WixUI_Advanced but I don't need the other dialogs from that UI, I decided to create my own UI by copying WixUI_Minimal code and renaming to WixUI_MyMinimal. Then I changed some of the sequences and button names so I could put InstallScopeDlg after the WelcomeEulaDlg and before ProgressDlg. I also copied the other required dialogs to my Wix project in visual studio.
The interface is shown correctly but the "Next" button on InstallScopeDlg does not work and shows the ProgressDlg without doing anything.

1 - 这是添加 InstallScopeDlg 的正确解决方案吗?
2 - 我该如何解决这个问题?

1 - Is this a correct solution to add the InstallScopeDlg?
2 - How can I fix this problem?

以下是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>

推荐答案

看看我的开源项目 ISWIX (CodePlex).它包括一个多项目解决方案模板,其中包括一个用于构建 MSI 的项目.它添加了对 WiXUI 的引用,并使用一系列片段来引用内置对话框集,然后使用一个附加引用将自定义对话框插入到该集中.这是通过将 Publish 元素 (DoAction ControlEvents) 添加到相邻对话框的 Next 和 Back 按钮来完成的.所有这一切都以一种尽可能接近继承的方式实现.

Take a look at my open source project ISWIX (CodePlex). It includes a multiple project solution template that includes a project for building the MSI. It adds a reference to WiXUI and uses a series of fragments to reference a built in dialog set and then one additional reference to insert a custom dialog into the set. This is done by adding Publish elements (DoAction ControlEvents) to the Next and Back buttons of the neighboring dialogs. All of this is achieved in a way that feels as close to inheritance as possible.

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

此外,请确保您确实希望支持按用户安装.它们处理起来很麻烦,而且仅在有限的情况下才有价值.

Also, be very sure you really want to support per-user installations. They are a pain to deal and only valuable in limited scenarios.

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

这篇关于Wix UI 自定义:将 InstallScopeDlg 添加到 WixUI_Minimal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆