Subject: WiX help
Date: Fri, 18 May 2007 13:06:29 -0700 (PDT)
Hi,
I am new to WiX and have just started using it for one
of my deployment project. Can you please let me know
how to set the configuration parameters to MSI from an
XML file.
For example. I am creating a network share and I want
the location to be provided as input but not through
UI. I will be passing the share location in XML file
and execute the MSI using that. Similary for Web sites
and Virtual Directories. I would like to have the
source code with this scenario as an example.
Thanks
Currently WiX doesn't directly support this feature. But you can achieve this easily. What you need to do is write a VBS custom action to read the Xml configuration parameters and set them as MSI properties. See the customization VBS example below. Or you can simply use our free WiX tool WiXSharp.
WiX CustomAction: SetProperties.vbs
Sub SetProperties
strXmlConfigFile = Session.Property("XMLCONFIG")
Set objDoc = CreateObject("msxml2.DOMDocument.3.0")
objDoc.Load(strXmlConfigFile)
Session.Property("MYFUNKYPROP") = objDoc.selectSingleNode("/root/Parameter[@name='Something']").text
Set objDoc = Nothing
End Sub
WiX fragment example:
<Wix xmlns="http://schemas.microsoft.com/wix/2003/01/wi">
<Fragment Id="SetProperties">
<Binary Id="SETPROPERTIES" SourceFile="SetProperties.vbs" />
<CustomAction Id="SetProperties" BinaryKey="SETPROPERTIES" VBScriptCall="SetProperties" Execute="immediate" />
<InstallExecuteSequence>
<Custom Action="SetProperties" After="LaunchConditions" />
</InstallExecuteSequence>
</Fragment>
</Wix>
THIS POST IS PROVIDED "AS-IS" WITH NO WARRANTIES AND CONFERS NO RIGHTS. Build time: Sun 01/27/2008 . ©2007 Dalun Software. All rights reserved. Back to Article List