我怎样才能在 WiX 中至少需要两个可选组件之一?

发布于 2024-08-03 19:18:24 字数 941 浏览 4 评论 0 原文

我正在使用 WixUIFeatureTree 为用户提供他们想要安装的应用程序组件的选项...我的功能之一包含两个可选功能,至少必须安装其中之一才能使程序正常工作。我不想强迫用户安装任一特定的,但我不知道如何强迫他们选择至少一个

这是我当前 WXS 的相关部分:

    <Feature Id="Main" Title="Product Name" Level="1" Absent="disallow" Display="expand" AllowAdvertise="no"
             Description="This is the application, and is a required component"
             >
        <ComponentRef Id="Baseline" />
        <ComponentRef Id="Shortcuts" />
        <Feature Id="Option1" Title="Plugin #1" Level="2" Absent="allow" AllowAdvertise="no">
            <ComponentRef Id="Plugin1Component" />
        </Feature>
        <Feature Id="Option2" Title="Plugin #2" Level="3" Absent="allow" AllowAdvertise="no">
            <ComponentRef Id="Plugin2Component" />
        </Feature>
    </Feature>

我猜我需要在序列的正确位置插入某种自定义操作,以确保选择其中一个进行安装,但不知道该怎么做是这样,或者说是否正确。感谢所有帮助!

I am using WixUIFeatureTree to offer the user an option of what components of my application they want to install... One of my features has two optional features within it, at least one of which must be installed for the program to work. I don't want to force the user to install either particular one, but I'm at a loss as to how to force them to choose at least one.

Here's the relevant portion of my current WXS:

    <Feature Id="Main" Title="Product Name" Level="1" Absent="disallow" Display="expand" AllowAdvertise="no"
             Description="This is the application, and is a required component"
             >
        <ComponentRef Id="Baseline" />
        <ComponentRef Id="Shortcuts" />
        <Feature Id="Option1" Title="Plugin #1" Level="2" Absent="allow" AllowAdvertise="no">
            <ComponentRef Id="Plugin1Component" />
        </Feature>
        <Feature Id="Option2" Title="Plugin #2" Level="3" Absent="allow" AllowAdvertise="no">
            <ComponentRef Id="Plugin2Component" />
        </Feature>
    </Feature>

I'm guessing that I'm going to need some kind of Custom Action inserted at the right point of the sequence guaranteeing that one or the other is selected for install, but no clue how to do that, or if it's even right. All help appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

把人绕傻吧 2024-08-10 19:18:24

我意识到这是一篇旧帖子,但这就是我使用 WIX v3.7 和 UI FeatureTree 解决此问题的方法:

<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">&MyAppClientFeature=3 OR &MyAppPrinterFeature=3</Publish>

完整的 FeatureTree 覆盖代码:

<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" />

    <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="VerifyReadyDlg">&MyAppClientFeature=3 OR &MyAppPrinterFeature=3</Publish>

    <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" 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" />

我希望这可以帮助别人。

I realize this is an old post, but this is how I solved this using WIX v3.7 with the UI FeatureTree:

<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">&MyAppClientFeature=3 OR &MyAppPrinterFeature=3</Publish>

Full FeatureTree override code:

<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" />

    <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="VerifyReadyDlg">&MyAppClientFeature=3 OR &MyAppPrinterFeature=3</Publish>

    <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" 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" />

I hope this helps someone out.

山有枢 2024-08-10 19:18:24

我认为您真正想要在这里做的是在 中添加一个条件。下一步按钮的元素,在满足您的条件之前不会启用它。比如:

<Publish Dialog="..." Control="Next" Event="NewDialog" Value="...">OptionalPkg1Selected OR OptionaloPkg2Selected</Publish>

我不知道如何根据检查的组件设置这些条件,尽管必须有某种方法来做到这一点,以便稍后安装正确的组件......

I think what you actually want to do here is put a condition in the <Publish> element for the Next button to not enable it until your conditions are met. Something like:

<Publish Dialog="..." Control="Next" Event="NewDialog" Value="...">OptionalPkg1Selected OR OptionaloPkg2Selected</Publish>

What I don't know is how to set those conditions based on which components are checked, though there has to be some way to do it so that the right components get installed later on...

梅窗月明清似水 2024-08-10 19:18:24

使用功能状态作为条件怎么样?

类似 (&Option1=2) AND (&Option2=2)

以下是更好理解的链接:

MSI 高级自定义操作

How about using the Feature state as a condition?

Something like (&Option1=2) AND (&Option2=2)

Here is a link for better understanding:

MSI Advanced Custom Actions

月隐月明月朦胧 2024-08-10 19:18:24

我现在没有时间进行技术测试,只是想向您指出 INSTALLLEVEL 属性的方向。这是一个与特征选择相关的相当反直觉的概念。本质上,安装有一个整体的 INSTALLLEVEL,它是 1 到 32,767 之间的一个数字,每个功能都有一个安装级别属性,它是 -32,767 到 32,767 之间的一个数字。如果功能的安装级别值小于或等于产品的 INSTALLLEVEL 属性,则打开该功能: http://kb.acresso.com/selfservice/viewContent.do?externalID=Q103232

通常,您使用它来设置默认功能状态并在该功能不存在的操作系统上禁用隐藏功能不支持。但是,您可以将这些属性与在对话框的下一个按钮事件上运行的自定义操作一起使用,以强制选择至少一项功能。

是的,MSI 对话框通常没有任何意义,而且使用起来非常复杂。在某些情况下,我将序列中的单个对话框替换为常规 Windows exe 对话框,以解决整个 MSI GUI 概念中的限制。

我会考虑是否有更简单的方法来做到这一点。听起来这很紧急,所以也许您想咨询部署社区并仔细研究一些最好的部署站点:

I don't have time to run a technical test right now, but just want to point you in the direction of the INSTALLLEVEL Property. It's a rather counter-intuitive concept related to feature selections. Essentially there is an overall INSTALLLEVEL of the installation, which is a number between 1 and 32,767 and features each have an Install Level property, which is a number between -32,767 and 32,767. If a feature's Install Level value is less than or equal to the product's INSTALLLEVEL property, the feature is turned on: http://kb.acresso.com/selfservice/viewContent.do?externalID=Q103232

Generally you use this to set the default feature states and to disable hidden features on operating systems where the feature isn't supported. However, you may be able to use these properties along with a custom action run on the dialog's next button event to enforce selection of at least one of your features.

And yes, MSI dialogs in general make no sense, and they are way to complicated to work with. In some cases I have replaced a single dialog in a sequence with a regular windows exe dialog to work around limitations in the overall MSI GUI concept.

I'll have a think if there is an easier way to do this. It sounds like this is very urgent though, so perhaps you want to check with the deployment communities and peruse some of the best deployment sites:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文