Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include a text file content into a WiX script

Is there a way to read value for the WiX variable from a text file?

What I am trying to do is to include a version-specific information into instlal package.

This version information extracted into the text file on the pre-build step, the question is how to propages this text file content into a build process.

One of the possible solution is to update whole .wxs file on the pre-build step too, but it feel a bit sloppy.

Is there any other, less-intrusive way?

Thank you.

like image 481
user48829 Avatar asked Dec 30 '22 06:12

user48829


1 Answers

Create a separate file 'includes.wxi', for example like this:

<?xml version="1.0" encoding="utf-8"?>
<Include Id="VersionNumberInclude">
    <?define MajorVersion="1" ?>
    <?define MinorVersion="5" ?>
    <?define MicroVersion="99" ?>
    <?define BuildVersion="14954" ?>
</Include>

In your wxs file, you can include this file like this:

<?include VersionNumberInclude.wxi ?>

And the defines can be used like this:

<?define VersionNumberInternal="$(var.MajorVersion).$(var.MinorVersion).$(var.BuildVersion)" ?>
<?define VersionNumberUserVisible="$(var.MajorVersion).$(var.MinorVersion).$(var.MicroVersion).$(var.BuildVersion)" ?>
like image 170
Stefan Avatar answered Jan 10 '23 07:01

Stefan