开发者

How do I do a MSBuild Condition testing if an ItemGroup contains an item?

开发者 https://www.devze.com 2023-04-09 00:30 出处:网络
This should be simple, but I can\'t find how to do this (or maybe it\'s not possible). In MSBuild I have an ItemGroup that is a list of files.

This should be simple, but I can't find how to do this (or maybe it's not possible).

In MSBuild I have an ItemGroup that is a list of files. I want to execute a开发者_运维问答 task only if a particular file is in that ItemGroup

Something like:

<Copy Condition="@(Files) <contains> C:\MyFile.txt" .... />

Any way to do this? Preferably without writing a custom task.

Edit: The list of files is only to do with the condition. Otherwise it has no relation to the task.


Try

<Copy Condition="'%(Files.Identity)' == 'C:\MyFile.txt'" .. />

0

精彩评论

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