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

标签 wix wix3.5 merge-module

我在使用 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"/>

最佳答案

请记住,公共(public)属性必须大写。

您可以在这里找到答案: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Passing-properties-to-merge-modules-td5417112.html

关于Wix:将对话控制值传递给可配置的合并模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7502383/

相关文章:

c# - Wix 隐藏命令行窗口

.net - WiX - 在设置输出中收集非项目程序集

installation - 尝试在 Wix 中使用 EnsureTable 修复验证错误

msbuild - 从 .vdproj 构建没有 Devenv 的合并模块

windows - 如何使 Windows 安装程序更新注册表字符串值(不是多字符串)中的列表?

Wix Burn - 自定义模板

windows - 为什么 msi 安装程序是使用 Windows 安装程序 xml 创建的,即仅 wix?

wix - 如何在 Wix 中包含片段?

crystal-reports - 检测 x86/x64 并安装正确的 .msi