Wix: Passing Dialogue Control Values to Configurable Merge Modules
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"开发者_如何学C Action="setValue" ElementPath="/configuration/system.serviceModel/client/endpoint/@address" File="[#Se.Gui.exe.config]" Value="[EndpointAddress]/ApiDataService"/>
Remember that public properties must be in UPPERCASE.
You can find the answer here: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Passing-properties-to-merge-modules-td5417112.html
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
精彩评论