I am trying to create a group of items in the Files task with a metadata attribute called TargetPath populated with the relative path to the file.
Example:
For these paths:
D: \ Test \ Blah.exe
D: \ Test \ Config \ fun.config
D: \ Test \ en-US \ my.resources.dll
The output should be:
File Target = Blah.exe
File Target = Config \ fun.config
File Target = en-US \ my.resources.dll
Here is my best attempt ... hope this makes my question clearer:
<ItemGroup> <Files Include="d:\test\**\*" > <TargetPath>%(RecursiveDir)%(Filename)%(Extension)</TargetPath> </Files> </ItemGroup> <Message Text="File Target = @(Files->'%(TargetPath)')"/>
I would like the TargetPath to populate correctly ... currently it seems empty or empty. Does anyone know what I am missing?
Edit:
Yes, I understand that I can do this:
<Message Text="File Target = @(Files->'%(RecursiveDir)%(Filename)%(Extension)')"/>
However, I am creating this ItemGroup to use the ResolveManifestFiles MSBuild task, which requires me to create a TaskItem with the TargetPath metadata attribute in order to be able to customize this value.
msbuild
Anderson mes
source share