I want to pass a semi-colon separated list of strings.
Each string represents a file name.
<PropertyGroup>
<FileNames>Newtonsoft.Json;Reactive</FileNames>
<PathToOutput>C:/</PathToOutput>
</PropertyGroup>
Now I want to create an item group which should give me all the files in particular folder excluding list of Filename, something like:
<ItemGroup>
<ReleaseFiles Include="$(PathToOutput)\**\*.*" Exclude="%(identity)-> identity.contains(%FileNames)"/>
</ItemGroup>
How do I iterate through current folder's files and match each ones name if it contains any one filename in Filenames variable.
Pretty sure this is a duplicate but I cannot find it at the moment so here it goes:
Include=$(Property)
Exclude
only works if you have a list of exact matches, but you need more arbitrary filtering here so you'll needCondition
Contains
is a property function (well, or a System::String method) so won't work as such on metadata, hence we turn metadata into a string firstIn code:
Use the standard way to exclude files files from an item group by using the Exclude attribute and referencing another item group. It'll be much easier to understand.
Example: