I have a list of projects in my MSBuild file:
<ItemGroup> <SubProject Include="**\*.csproj" /> </ItemGroup>
And now I would like to set my TargetPath
for each project in the metadata property for each project.
I already know how to extract the target path for each project and put it in a separate list of elements:
<Target Name="ExtractTargetPaths"> <MSBuild Projects="%(SubProject.Identity)" Targets="GetTargetPath"> <Output TaskParameter="TargetOutputs" ItemName="SubProjectTargetPath" /> </MSBuild> </Target>
However, I would like to have access to this "SubProjectTargetPath" as metadata in the SubProject
elements instead of a separate list of elements.
That is, instead of writing, for example. this is:
<SomeTask Parameter="%(SubProjectTargetPath.Identity)" />
I could write something like:
<SomeTask Parameter="%(SubProject.TargetPath)" />
source share