Wix:将对话控制值传递给可配置的合并模块

发布于 2024-12-05 22:01:49 字数 2737 浏览 7 评论 0原文

我无法使用 Wix 工具集完成任务。特别是,我有一个场景,我有一个配置 MSM(可配置模块)的 MSI。 MSI 有一个自定义 UI 对话框,用户输入可用于配置 MSM。

当我尝试使用地址属性的硬编码值来配置 MSM 时,如下所示,它工作正常并且 MSM 配置正确。 (我相信这种配置是在构建时而不是运行时发生的 - 问题可能就在那里。)。

当我在安装时(即运行时)使用自定义对话框设置地址属性的值时,就会出现问题。可配置模块仍然使用硬编码值,而不是用户输入。问题是因为合并模块配置仅在构建时完成。有没有办法从主 MSI 的 UI 向合并模块传递值?

这是一个过于简化的版本:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

    <Product Id="cf1d176d-2d57-435e-8e7f-abba14de821c" Language="1033">

        <Media Id="1" Cabinet="SemanticEvolution.cab" EmbedCab="yes" />

        <Property Id="Address" Value="http://127.0.0.1" />

        <Directory Id="TARGETDIR" Name="SourceDir">

            <Directory Id="ProgramFilesFolder">

                <Directory Id="INSTALLLOCATION" Name="Semantic Evolution">

                    <Merge Id="MergeModule" Language="1033" SourceFile="Module.msm" DiskId="1">

                        <ConfigurationData Name="EndpointAddressConfiguration" Value="[Address]" />

                    </Merge>

                </Directory>

           </Directory>

        </Directory>

        <Feature Id="SemanticEvolutionFeatures" Title="Semnatic Evolution" Level="1">

            <Feature Id="TestFeature" Title="TestFeature" Level="1">
                <MergeRef Id="MergeModule" />
            </Feature>

        </Feature>

        <UI Id="CustomWixUI">

            <UIRef Id="WixUI_FeatureTree" />

            <DialogRef Id="ConfigurationDlg" />

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

        </UI>

    </Product>

</Wix>

这是合并模块的片段:

<Configuration Name="EndpointAddressConfiguration" Format="Text" />

<Substitution Table="CustomAction" Row="SetEndpointAddress" Column="Target" Value="[=EndpointAddressConfiguration]" />

<CustomAction Id="SetEndpointAddress" Property="EndpointAddress" Value="[EndpointAddress]" />

<InstallExecuteSequence>
  <Custom Action="SetEndpointAddress" Before="LaunchConditions">1</Custom>
</InstallExecuteSequence>

最终在合并模块中,配置的属性按如下方式使用:

<util:XmlFile Id="EndpointAddress" Action="setValue" ElementPath="/configuration/system.serviceModel/client/endpoint/@address" File="[#Se.Gui.exe.config]" Value="[EndpointAddress]/ApiDataService"/>

I'm having trouble accomplishing a task with the Wix Toolset. In particular, I have a scenario where I have an MSI that configures an MSM (Configurable Module). The MSI has a custom UI dialogue from which user input is to be used to configure the MSM.

When I try to configure the MSM using a hardcoded value for the address property as shown below it works fine and the MSM is configured correctly. (I believe this configuration happens and build-time as opposed to run-time - the issue may lay there.).

The problem occurs when I use a custom dialogue to set the value of the address property at installation time (i.e run-time). The configurable module still uses the hardcoded value, rather than the users input. Is the problem because merge module configuration is done during build-time only. Is there a way to pass a value to the merge module from the UI of the main MSI?

Here is an over simplified version:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

    <Product Id="cf1d176d-2d57-435e-8e7f-abba14de821c" Language="1033">

        <Media Id="1" Cabinet="SemanticEvolution.cab" EmbedCab="yes" />

        <Property Id="Address" Value="http://127.0.0.1" />

        <Directory Id="TARGETDIR" Name="SourceDir">

            <Directory Id="ProgramFilesFolder">

                <Directory Id="INSTALLLOCATION" Name="Semantic Evolution">

                    <Merge Id="MergeModule" Language="1033" SourceFile="Module.msm" DiskId="1">

                        <ConfigurationData Name="EndpointAddressConfiguration" Value="[Address]" />

                    </Merge>

                </Directory>

           </Directory>

        </Directory>

        <Feature Id="SemanticEvolutionFeatures" Title="Semnatic Evolution" Level="1">

            <Feature Id="TestFeature" Title="TestFeature" Level="1">
                <MergeRef Id="MergeModule" />
            </Feature>

        </Feature>

        <UI Id="CustomWixUI">

            <UIRef Id="WixUI_FeatureTree" />

            <DialogRef Id="ConfigurationDlg" />

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

        </UI>

    </Product>

</Wix>

Here is a snipet of the merge module:

<Configuration Name="EndpointAddressConfiguration" Format="Text" />

<Substitution Table="CustomAction" Row="SetEndpointAddress" Column="Target" Value="[=EndpointAddressConfiguration]" />

<CustomAction Id="SetEndpointAddress" Property="EndpointAddress" Value="[EndpointAddress]" />

<InstallExecuteSequence>
  <Custom Action="SetEndpointAddress" Before="LaunchConditions">1</Custom>
</InstallExecuteSequence>

Eventually in the merge module the configured property is used as follows:

<util:XmlFile Id="EndpointAddress" Action="setValue" ElementPath="/configuration/system.serviceModel/client/endpoint/@address" File="[#Se.Gui.exe.config]" Value="[EndpointAddress]/ApiDataService"/>

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

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

发布评论

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

评论(2

中性美 2024-12-12 22:01:49

要从合并模块访问属性,您必须将合并模块 ID 附加到属性名称。类似于:MyProp.msm_guid

http://msdn.microsoft。 com/en-us/library/aa370051(VS.85).aspx

To access a property from a merge module you must append the merge module id to the property name. Something like: MyProp.msm_guid

http://msdn.microsoft.com/en-us/library/aa370051(VS.85).aspx

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