如何在构建安装包时自动选择源文件
我有以下要求: 两个文件夹A和B,对于文件a,如果它存在于A中,我们将其构建到我们的安装包中,否则我们使用文件夹B中的文件a作为默认选择。如何实施?请帮忙。
i have the following requirement:
two folders A and B, for file a, if it exists in A, we build it into our install packet, otherwise we use file a in folder B as the default selection. how to implement this? please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想说这项工作应该在 WiX 和你的构建引擎之间分配。此外,大部分责任都在建造引擎。
在 WiX 中,您可以通过以下方式创作相关文件(我们称之为
a.txt
)(它是 Component 元素的子元素):这样,您应该将 DataFolder 变量的值传递给Candle.exe(WiX 的编译器)。这可以通过多种方式完成,通过命令行或通过项目设置(如果您创作 *.wixproj)。假设您使用第一个选项进行操作,并且您的构建引擎是 NAnt:
请注意,这只是一个供您了解想法的示例。 WiX 还与 MSBuild 友好。
然后,构建引擎负责选取正确的
${data.folder}
,在您的情况下是 A 或 B。I would say this job should be split between WiX and your build engine. Moreover, the most of the responsibility goes to build engine.
In WiX you can author the file in question (let's call it
a.txt
) in the following way (it's a child of a Component element):Having that, you should pass the value of DataFolder variable to candle.exe (the compiler of WiX). This can be done in a couple of ways, via the command line or via the project settings (if you author *.wixproj). Let's say, you're doing it with the first option and your build engine is NAnt:
Note that it's just a sample for you to get the idea. WiX is also friendly with MSBuild.
The build engine is then responsible for picking up the correct
${data.folder}
, whch is either A or B in your case.