支持 WiX 3.5 中的不同 AfterBuild 行为
我绝对没有运气找到有关支持目标的多个条件的信息。具体来说,根据项目配置,我希望 AfterBuild
执行不同的操作。
例如,如果我的项目配置是 A,我想运行批处理 a.bat,如果我的项目配置是 B,我想运行 b.bat。我的 WiX 项目文件具有以下目标:
<Target Name="AfterBuild" Condition="'$(Configuration)'=='A'">
<Exec Command="c:\installers\a.bat" />
</Target>
<Target Name="AfterBuild" Condition="'$(Configuration)'=='B'">
<Exec Command="c:\installers\b.bat" />
</Target>
现在,这里的 WiX 专家已经知道这并不'不工作。当它确实编译和执行时,WiX只会尊重最后一个AfterBuild
目标的意愿。我四处寻找有关在 Target
中使用
的信息,但看起来这仅对其他元素有效。
谁能提供正确的 XML 语言来支持目标中的多个条件?
编辑 - 也许唯一的答案是将 $(Configuration) 作为参数传递,然后让批处理文件进行排序?
I've had absolutely no luck in finding information about supporting multiple conditions for a Target. Specifically, depending upon the project configuration, I'd like AfterBuild
to do different things.
For example, I want to run a batch a.bat if my project configuration is A, and b.bat if my project configuration is B. My WiX project file has the following Targets:
<Target Name="AfterBuild" Condition="'$(Configuration)'=='A'">
<Exec Command="c:\installers\a.bat" />
</Target>
<Target Name="AfterBuild" Condition="'$(Configuration)'=='B'">
<Exec Command="c:\installers\b.bat" />
</Target>
Now the WiX experts here already know that this doesn't work. While it does compile and execute, WiX will only respect the wishes of the last AfterBuild
Target. I looked around for information about using <Condition>
within Target
, but it looks like that's only valid for other elements.
Can anyone present the correct XML language for supporting multiple conditions in Targets?
EDIT -- perhaps the only answer is to pass $(Configuration) as an argument and then let the batch file sort things out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我觉得自己很愚蠢。
Target
不仅有一个Condition
属性,而且您还可以将其与Exec
(以及其他类似Copy
>,我正在使用)。因此,您只需在AfterBuild
目标中放置多个
和
元素即可。I feel stupid. Not only is there a
Condition
attribute forTarget
, but you can also use it withExec
(and others likeCopy
, which I am using). So you just have to put multiple<Exec>
and<Copy>
elements within theAfterBuild
Target, and it works out.