Tuesday, May 22, 2012

MS Build copy a list of directories stored in Item

I have a text file which contains some locations of the files which I want to copy to a temp directory



---- List.txt ----
Build\Java
Build\Classes


Now, I am fetching this list into an Item



<ReadLinesFromFile File="List.txt" >
<Output TaskParameter="Lines"
ItemName="DirectoryList" />
</ReadLinesFromFile>


Now, In order to append the full path, and add some excludes, I am again storing it into another ItemGroup:



<ItemGroup>
<PackageList Include="$(BuildPath)\%(DirectoryList.Identity)\**\*.*"
Exclude="$(BuildPath)\%(DirectoryList.Identity)\**\*.pdb" />
</ItemGroup>

<Copy SourceFiles="%(PackageList.Identity)"
DestinationFolder="$(PackageTemp)\%(RecursiveDir)" />


ISSUE:



Actual Dir -



C:\Work\Build\Java\Debug
C:\Work\Build\Java\Release
C:\Work\Build\Classes\*.class


Content in O/p



C:\temp\Debug
C:\temp\Release
C:\temp\*.class


How to make it copy the corresponding "Java" and "Classes" folder also?





No comments:

Post a Comment