如何为 Wix Bundle 日志元素设置自定义值?

How to set custom value to Wix Bundle Log Element?

如果我输入一个硬编码值,它就可以正常工作

<Log PathVariable="C:\myProjectDir\myLogs\log.txt"/>

但是如果我创建一个单独的变量并替换硬代码,它就不起作用

<Log PathVariable="[LogLocation]"/>
<Variable Name="LogLocation" bal:Overridable="no" Type="string" Value="C:\myProjectDir\myLogs\log.txt" Persisted="yes"/>

我在 <WixVariable Id="WixBundleLog"/> 的行中找到了一些东西,但我真的不知道如何使用它。

我的最终目标是我有一个引导程序应用程序,我想更改创建我的 msi 和 exe 安装日志的位置

我能够使用 _bootstrapper.Engine.StringVariables["LogLocation"] = "C:\ProjectGorilla\logs\log.txt"

更改 Variable 元素值

在 C# 中使用上述代码,Variable Id="LogLocation" 已更改,但该更改未反映在 日志元素的 PathVariable

所以,我的问题是如何在 Log 元素的 PathVariable 属性中放置一个变量

提前致谢:)

根据 documentationPathVariable 属性为:

Name of a Variable that will hold the path to the log file. An empty value will cause the variable to not be set. The default is "WixBundleLog".

PathVariable没有指定(bundle)日志写入的路径。如果 BA 想要将文件复制到其他地方,它应该是一个变量。 Burn 引擎从不读取此变量的值,因此在运行时更改它不会执行任何操作。

(包)日志已创建(https://github.com/wixtoolset/wix3/blob/58abd6993afba08b39e37b0e76b1790161df9231/src/burn/engine/engine.cpp#L499) before loading the BootstrapperApplication (https://github.com/wixtoolset/wix3/blob/58abd6993afba08b39e37b0e76b1790161df9231/src/burn/engine/engine.cpp#L545)。 BA没办法改路径

包(MSI、EXE 等)日志位置今天的工作方式与捆绑包日志相同。然而,由于它们是在加载 BA 之后创建的,理论上可能有人可以实现一个功能,以便 BA 可以更改它们的路径。