开发者

Supporting different AfterBuild behaviors in WiX 3.5

开发者 https://www.devze.com 2023-03-31 20:54 出处:网络
I\'ve had absolutely no luck in finding information about supporting multiple conditions for a Target.Specifically, depending upon the project configura开发者_StackOverflow中文版tion, I\'d like AfterB

I've had absolutely no luck in finding information about supporting multiple conditions for a Target. Specifically, depending upon the project configura开发者_StackOverflow中文版tion, 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?


I feel stupid. Not only is there a Condition attribute for Target, but you can also use it with Exec (and others like Copy, which I am using). So you just have to put multiple <Exec> and <Copy> elements within the AfterBuild Target, and it works out.

0

精彩评论

暂无评论...
验证码 换一张
取 消