MSBuild: Get dirs and specific file as property

I'm new to MSBuild and playing with it to learn more about it before implementing it some more into our workflow.

What I'm trying to do: Create a file that will go through the subdirectories and run a clean target on the "master" solution.

I've been able to get a list of the folders, but I'm having trouble appending the file on the property/item.

Folder Structure:

c:\Dev\Branch-1 c:\Dev\Branch-2 c:\Dev\Branch-3 c:\Dev\Branch-4 

Code snippet so far:

<PropertyGroup> <DevDir>c:\dev</DevDir> </PropertyGroup> <ItemGroup> <SubfolderFullPaths Include="$([System.IO.Directory]::GetDirectories('$(DevDir)', 'Branch-*'))" /> <SolutionsToClean Include="@(SubfolderFullPaths)" /> </ItemGroup> <Target Name="Clean"> <Message Text="SolutionsToClean: @(SolutionsToClean)" /> </Target> 



What would be the best way to continue? Also, the file takes long to run because, I think, it's recursively going down the tree. Thoughts?

by mrdat via /r/csharp

Leave a Reply