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 133451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:26:05+00:00 2026-05-11T06:26:05+00:00

See this MSDN post for some background: Using metadata to call a target multiple

  • 0

See this MSDN post for some background: Using metadata to call a target multiple times with different parameters

The solution put forward was to use metadata in a Task’s Output attribute to force the batching of the task.

It so happens that our build step is partitioned across a few targets. My requirement is for the dependencies to run sequentially in a sort of inner loop.

I tried the concept out with the following script:

<?xml version='1.0' encoding='utf-8'?> <Project DefaultTargets='BuildSolutions'          xmlns='http://schemas.microsoft.com/developer/msbuild/2003'          ToolsVersion='3.5'>     <ItemGroup>         <BuildFile Include='myscript.txt'>           <InstallerFileName>MyInstaller1.msi</InstallerFileName>           <CustomTwiddleBit>true</CustomTwiddleBit>           <OtherCustomTwiddleBit>false</OtherCustomTwiddleBit>         </BuildFile>         <BuildFile Include='myscript.txt'>           <InstallerFileName>MyInstaller2.msi</InstallerFileName>           <CustomTwiddleBit>false</CustomTwiddleBit>           <OtherCustomTwiddleBit>true</OtherCustomTwiddleBit>         </BuildFile>     </ItemGroup>      <Target           Name='BuildInstallers'          Outputs='OutputDir\%(BuildFile.InstallerFileName)'          DependsOnTargets='Step3'      >         <Exec Command='echo %(BuildFile.InstallerFileName)' />     </Target>      <Target Name='Step1'>           <Exec Command='echo step 1 %(BuildFile.InstallerFileName)' />      </Target>       <Target Name='Step2'              DependsOnTargets='Step1'>           <Exec Command='echo step 2 %(BuildFile.InstallerFileName)' />      </Target>       <Target Name='Step3'              DependsOnTargets='Step2'>           <Exec Command='echo step 3 %(BuildFile.InstallerFileName)' />      </Target>       </Project> 

The output was as follows:

Microsoft (R) Build Engine Version 3.5.30729.1   [Microsoft .NET Framework, Version 2.0.50727.3053]   Copyright (C) Microsoft Corporation 2007. All rights reserved.    Build started 2/16/2009 20:41:14.   Project 'D:\Source\test\test.proj' on node 0 (BuildInstallers target(s)).     step 1 MyInstaller1.msi     step 1 MyInstaller2.msi   Step2:     step 2 MyInstaller1.msi     step 2 MyInstaller2.msi   Step3:     step 3 MyInstaller1.msi     step 3 MyInstaller2.msi   BuildInstallers:     MyInstaller1.msi   BuildInstallers:     MyInstaller2.msi   Done Building Project 'D:\Source\test\test.proj' (BuildInstallers target(s)).     Build succeeded.       0 Warning(s)       0 Error(s)    Time Elapsed 00:00:00.43  

Any ideas how I might get the output to be like so:

step 1 MyInstaller1.msi step 2 MyInstaller1.msi step 3 MyInstaller1.msi  step 1 MyInstaller2.msi step 2 MyInstaller2.msi step 3 MyInstaller2.msi 
  • 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. 2026-05-11T06:26:06+00:00Added an answer on May 11, 2026 at 6:26 am

    I sure see the problem here as

    <Exec Command='echo step 1 %(BuildFile.InstallerFileName)' /> 

    Will iterate again and again on the InstallerFileName output. I think you can call a custom target instead and that target go through each of your steps. Call this target from the main script with the MSBuild Task, something like this:

    <MSBuild Projects='CustomTargets.proj'    Targets='BuildInstallers'   Properties='BuildFile=%(BuildFile.InstallerFileName)' /> 

    And in you BuildInstallers target you would use

    <Target ='BuildInstallers' DependsOnTargets='Step3' > </Target>  <Target Name='Step1'>       <Exec Command='echo step 1 $(BuildFile)' />  </Target>  

    etc

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 169k
  • Answers 169k
  • 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 A few points: It's not null safe or "different type"… May 12, 2026 at 1:54 pm
  • Editorial Team
    Editorial Team added an answer Use the RemoveDir() procedure instead. Make sure it is not… May 12, 2026 at 1:54 pm
  • Editorial Team
    Editorial Team added an answer So, I posted a bit too soon. Right click on… May 12, 2026 at 1:54 pm

Related Questions

I'm trying to dynamically generate a gif image of a specified size and color
I am trying to get started doing some Silverlight development. I am interested in
So I've got a daily dashboard report in SSRS 2005. It has a parameter,
I've never seen this before. Please can somebody shed some light on it for

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.