Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WIX util:xmlfile File name is Source attribute

Tags:

xml

wix

I am moving from a Wise Installer to WIX and am using the util:xmlfile to update a configuration xml file.

This works.

<Component Id="config" Guid="*">
  <File Id="config" Source="..\Source\Desktop\prodconfig.xml" KeyPath="yes" Vital="yes" />
    <util:XmlFile 
      Id="_PORT_" File="[INSTALLDIR]prodconfig.xml"  
      Action="setValue" 
      Name="Port" Value="[PORT]" 
      ElementPath="//Configuration/CommConnectionPools/CommConnectionPool" 
      Sequence='1' />
  </File>
</Component>

This does not work.

<Component Id="config" Guid="*">
  <File Id="config" Source="..\Source\Desktop\prod-config.xml" KeyPath="yes" Vital="yes" />
    <util:XmlFile 
      Id="_PORT_" File="[INSTALLDIR]prod-config.xml"  
      Action="setValue" 
      Name="Port" Value="[PORT]" 
      ElementPath="//Configuration/CommConnectionPools/CommConnectionPool" 
      Sequence='1' />
  </File>
</Component>

When the .msi executes with the first component, everything is fine. In the second version, an error is returned "Error 25531. Failed to open XML file..."

As far as I can tell the only difference is the hyphen in the file name.

Any suggestions as to what the difference might be?

like image 978
Val Avatar asked Nov 05 '13 19:11

Val


People also ask

How to use Wix to congiure XML files during installation?

How to use WiX to congiure XML files during installation. One of WiX's powerful features is XML interaction. WiX can create and delete elements or change values and attributes inside XML files. To do this we use either the util:XmlFile or util:XmlConfig elements.

What is sourcedir in wixproj?

After some grepping, I found the actual path in the wixproj file, there SourceDir is defined as: which has really nothing to do with installation files and project files. I was able to add another PropertyGroup that mirrored the release group which now pointed to my debug files:

What is Wix source authoring and how does it work?

Though WiX source authoring refers to payload files, the compiler never looks at them; instead, only the binder does, when it creates cabinets containing them or copies them to an uncompressed layout. You can provide the binder with one or more binder input paths it uses to look for files.

What is the output file type of Wix?

For WiX, the output is an .msi package, .msm merge module, or .wixlib library, which have a third phase: binding payload files into the output. Light.exe includes both the linker and binder.


1 Answers

Try using the component's id instead of hard-coding the name

[#config] //which will refer to the File Id

instead of

[INSTALLDIR]prod-config.xml
like image 132
Chris Bednarski Avatar answered Sep 19 '22 13:09

Chris Bednarski