Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 543799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:35:18+00:00 2026-05-13T10:35:18+00:00

I’m trying to create a Files task item group with a metadata attribute called

  • 0

I’m trying to create a “Files” task item group with a metadata attribute called “TargetPath” populated with the relative path to a 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… hopefully this makes my question clearer:

<ItemGroup>
     <Files Include="d:\test\**\*" >
        <TargetPath>%(RecursiveDir)%(Filename)%(Extension)</TargetPath>
     </Files>
 </ItemGroup>

<Message Text="File Target = @(Files->'%(TargetPath)')"/>

I’d like “TargetPath” populated correctly… currently it appears to be null or empty. Anyone know what I’m missing?

Edit:

Yes, I realize I can do this:

<Message Text="File Target = @(Files->'%(RecursiveDir)%(Filename)%(Extension)')"/>

However, I’m building up this ItemGroup to use the ResolveManifestFiles MSBuild task, which requires that I build up a TaskItem with the TargetPath metadata attribute to be able to customize that value.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:35:19+00:00Added an answer on May 13, 2026 at 10:35 am

    You’re trying to assign dynamic metadata to an itemgroup before it’s created. In your example there’s no need to create custom metadata since this information is already part of the well-known metadata, so you can just do:

    <ItemGroup>
       <Files Include="d:\test\**\*" ></Files>
    </ItemGroup>
    
    <Message Text="File Target = @(Files->'%(RecursiveDir)%(Filename)%(Extension)')"/>  
    

    Or:

    <Message Text="File Target = %(Files.RecursiveDir)%(Files.Filename)%(Files.Extension)"/>
    

    EDIT:

    This example uses CreateItem task to dynamically update the itemgroup:

    <ItemGroup>
        <Files Include="d:\test\**\*" ></Files>
    </ItemGroup>
    
    <CreateItem
        Include="@(Files)"
        AdditionalMetadata="TargetPath=%(RecursiveDir)%(Filename)%(Extension)">
          <Output TaskParameter="Include" ItemName="Files"/>
    </CreateItem>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 306k
  • Answers 306k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The sessionFactory must be a thread-safe singleton. A common pattern… May 13, 2026 at 9:22 pm
  • Editorial Team
    Editorial Team added an answer Have you looked at this page yet? HOW TO: Implement… May 13, 2026 at 9:22 pm
  • Editorial Team
    Editorial Team added an answer An Applescript example is here, and the relevant part is:… May 13, 2026 at 9:22 pm

Related Questions

I'm rewriting our NAnt build scripts to make them cleaner and simpler, as well
I've been tasked with a project that requires me to convert a quote for
I'm trying to create a comma-delimited list of files or directories under the current
The task that I'm trying to handle is to create a set of wrappers
I'm trying to create a cron job that will send a weekly newsletter. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.