包括一个文本文件的内容到维克斯脚本 [英] Include a text file content into a WiX script
问题描述
时有没有办法从一个文本文件中的WiX可变的读取值?
Is there a way to read value for the WiX variable from a text file?
我所试图做的是包括一个特定版本的信息转换成instlal包。
What I am trying to do is to include a version-specific information into instlal package.
提取到的pre-生成步骤文本文件此版本信息,
问题是如何propages该文本文件的内容到一个构建过程。
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.
一个可能的解决方案是更新的pre-生成步骤整个.wxs文件
过,但觉得有点草率。
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?
感谢您。
推荐答案
创建一个单独的文件includes.wxi',比如像这样的:
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>
在您的WXS文件中,可以包含这个文件是这样的:
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)" ?>
这篇关于包括一个文本文件的内容到维克斯脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!