本文介绍了如何在Wix Toolset引导程序中读取文本文件的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用WiX工具集构建安装程序,我想从文本文件中读取版本.文本文件位于mybootstrapper中,如下所示:

I am using the WiX toolset to build an installer, I want to read the version from a text file. The text file is located in mybootstrapper like below:

下面是我要读取文本文件内容的代码

below is the code where i want to read the content of text file

<Bundle IconSourceFile='product.ico'
Name="Retail Grip"
Version="Version.txt" <!-- i know this is not correct -->
Manufacturer="Company Name"
UpgradeCode="PUT-GUID-HERE">

推荐答案

哦,它是WiX捆绑软件,即" "?我听说这是一种WiX工具吗?我不确定它是如何工作的(该链接中的页面截图).也许在使用编译器变量时有限制?

Oh, it is a WiX bundle - and that's "Wax"? I hear it is a WiX tool of sorts? I am not sure exactly how it works (screenshot down the page in that link). Maybe there are restrictions on the use of compiler variables when using it?

在看到蜡文件之前,我写了以下内容,我认为您使用的是普通的WiX源,而不是捆绑源.无论哪种方式,让我添加我写的内容,看看是否有帮助.相似之处.

I wrote the below before I saw that Wax file and I thought you had a normal WiX source and not a bundle source. Either way, let me add what I wrote and see if it helps. Similarities.

还: 尼尔·斯利特霍尔姆的WiX刻录模板 (朝顶部).请先旋转该链接.

Also: Neil Sleightholm's WiX Burn Template (towards top). Give that link a spin first please.

在常规的WiX文件中,您可以使用预处理器变量: $(var.CurrentVersion) (编译器变量).像这样:

In a regular WiX file you could use a pre-processor variable: $(var.CurrentVersion) (compiler variable). Something like this:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <?define UpgradeCode="PUT-GUID-HERE"?>
  <?define CurrentVersion="1.0.0.0"?>

  <Product Id="*" Name="Sample" Language="1033" Version="$(var.CurrentVersion)"
           Manufacturer="Someone" UpgradeCode="$(var.UpgradeCode)">

  <...>

您可以将变量放在其自己的包含文件"中: Variables.wxi .

You can put the variables in its own "include file": Variables.wxi.

<Include>
   <?define UpgradeCode="PUT-GUID-HERE"?>
   <?define CurrentVersion="1.0.0.0"?>
</Include>

此处采用这种方法的示例较多(一定要快速浏览一下)

Larger sample here for this approach (do have a quick skim of this one).

然后将文件包含在您的主要WiX源中:

And then include the file in your main WiX source:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <?include Variables.wxi ?>

  <Product Id="*" Name="Sample" Language="1033" Version="$(var.CurrentVersion)"
           Manufacturer="Someone" UpgradeCode="$(var.UpgradeCode)">

  <...>

还有本地化变量:-链接时间变量解析度(light.exe),而不是预处理器变量(candle.exe ). 某些上下文.

There are also localization variables: WiX (Windows Installer Xml), Create universal variables - link time variable resolution (light.exe), as opposed to the compile time resolution of pre-processor variables (candle.exe). Some context.

一些相关链接:

  • Localization Variables in use: Wix toolset license agreement multi-languages issue
  • How to make Win64 attribute as a variable in wixlib?
  • https://helgeklein.com/blog/2014/09/real-world-example-wix-msi-application-installer/

这篇关于如何在Wix Toolset引导程序中读取文本文件的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 23:58