Include a text file content into a WiX script

烈酒焚心 提交于 2019-12-03 17:27:29

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)" ?>

In my environment, WiX scripts are always built by the MSBuild file. That means that I can pass in any version-specific information I want on the command line. CruiseControl.NET passes these version numbers to my WiX script when built.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!