How do I do a MSBuild Condition testing if an ItemGroup contains an item?
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'" .. />
精彩评论