I need to filter an ItemGroup (containing filenames) based on the contents of the file. But I cannot get this to work.
<ItemGroup>
<FilteredFiles Include="@(AllFiles)"
Condition="$([System.IO.File]::ReadAllText(%(Identity)).Contains('searchText'))" />
</ItemGroup>
I get this error:
error MSB4184: The expression "[System.IO.File]::ReadAl lText(%(Identity))" cannot be evaluated. Could not find file 'C:\builds\git\RadarTemp%(Identity)'
Any suggestions?