WiX 源文件的相对路径 [英] WiX Relative Path to the Source File
问题描述
我的项目有一个简单的解决方案,效果很好.但我无法掌握如何使源路径相对.有人可以帮我吗?
<File Id="Bla.exe" Source="D:\Projects\Bla\Bla\bin\Debug\Bla.exe" KeyPath="yes" Checksum="yes"/></组件>
如何制作相对于 Wix 解决方案的路径?WiX 和所有必需的文件都在同一个解决方案中.
你可以像这样使用相对路径:
<File Id="Bla.exe" Source="..\bin\Debug\Bla.exe" KeyPath="yes" Checksum="yes"/>
或
您可以在项目中添加配置文件来定义公共变量.为此,向您的项目添加一个新的WiX 包含"文件,将其命名为 config.wxi.然后在你的包含文件中,你可以像这样定义一个 SourceDir 变量:
现在在您的 .wxs 文件中,您可以在顶部添加对配置文件的引用,例如:
然后像这样引用您的 SourceDir 变量:
此外,您可以使用一些内置的 WiX 项目变量.>
I have a simple Solution for my Project, which works well. But I am unable to grasp how to make the Source paths relative. Can somebody help me?
<Component Id="Bla.exe" Guid="*">
<File Id="Bla.exe" Source="D:\Projects\Bla\Bla\bin\Debug\Bla.exe" KeyPath="yes" Checksum="yes"/>
</Component>
How can I make the Path relative to the Wix Solution? WiX and all necessary files are in the same Solution.
You can use the relative path like so:
<File Id="Bla.exe" Source="..\bin\Debug\Bla.exe" KeyPath="yes" Checksum="yes"/>
OR
You can add a configuration file to your project to define common variables. To do so, add a new "WiX Include" file to your project, call it config.wxi. Then in your include file, you can define a SourceDir variable like so:
<?xml version="1.0" encoding="utf-8"?>
<Include>
<?define SourceDir = "D:\Projects\Bla\Bla\bin\Debug" ?>
</Include>
Now in your .wxs file, you can add a reference to the config file at the top, ex:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include "config.wxi"?>
Then just reference your SourceDir variable like so:
<File Id="Bla.exe" Source="$(var.SourceDir)\Bla.exe" KeyPath="yes" Checksum="yes"/>
Also, there are some built in WiX project variables that you may use.
这篇关于WiX 源文件的相对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!