Reputation: 4720
How can we find a specific file type under a path? I have checked MSBuild Task Reference but couldn't figure out.
Looking for something as:
<FindUnderPath Path="$(OutDir)" Files="*.txt">
<Output TaskParameter="InPath" ItemName="AllTxtFiles"/>
</FindUnderPath>
But it fails sayings "MSB3541: Files has invalid value "*.txt""
P.S. I am a rookie at msbuild tasks!
Upvotes: 0
Views: 728
Reputation: 3454
If you just need list of all txt files in certain folder you can get it as simple as
<ItemGroup>
<AllTxtFiles Include="$(PathToFolder)\**\*.txt" />
</ItemGroup>
Double stars (**) means that folder should be searched recursively for file pattern
Upvotes: 4
Reputation: 1246
You could use an ItemGroup to specify such files and reference the ItemGroup in the Files parameter. Something like:
<ItemGroup>
<MyFiles Include="*.txt" />
</ItemGroup>
<FindUnderPath Path="$(OutDir)" Files="@(MyFiles)">
<Output TaskParameter="InPath" ItemName="AllTxtFiles" />
</FindUnderPath>
Source: http://msdn.microsoft.com/en-us/library/vstudio/ms164293(v=vs.120).aspx
Upvotes: 1