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

  • SEARCH
  • Home
  • 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 8327399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:05:45+00:00 2026-06-09T01:05:45+00:00

Please read till I state my question clearly. I’m trying to implement a custom

  • 0

Please read till I state my question clearly. I’m trying to implement a custom msbuild task that will accept a variable number of input parameters from a msbuild script. I am aware of arrays of input parameters in customs tasks

public ITaskItem[] ArrayofItems { get; set; }

These can be declared as follows using either propertygroup/itemgroup

<PropertyGroup>
<Item1>1</Item>
<Item2>2</Item>
<Item3>3</Item>
<Item4>4</Item>
<Item5>5</Item></PropertyGroup>

 <ItemGroup>
<File Include="1"></File>
<File Include="2"></File>
<File Include="3"></File>
<File Include="4"></File>
<File Include="5"></File>  </ItemGroup>

Then from VS 2010 command line I can set/override the property as following

msbuild somefile.csproj /t:MyTarget /p:Item1=Name1;Item2=Name2…etc

My question is :- Is it possible to declare variable number of propertygroup/itemgroup in the build file so that I can pass in ‘n’ variable parameters from msbuild command line something like this using propertygroup/itemgroup?

msbuild somefile.csproj /t:MyTarget /p:Item1=Name1;Item2=Name2;ItemN=NameN (‘N’ Only for illustration purposes)

Is this even possible?

Thanks in advance, Any help will be greatly appreciated.

  • 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-06-09T01:05:46+00:00Added an answer on June 9, 2026 at 1:05 am

    If you call your build project like this…

    > msbuild My.proj /p:ItemProperty="1;2;3;4;5"
    

    And the project does this…

    <ItemGroup>
        <FromProperty Include="$(ItemProperty)" />
    </ItemGroup>
    <Message Text="%(FromProperty.Identity)" />
    

    …you have essentially converted a property into an array of items. If you were to convert to dymanically created properties, there would be no easy way to reference them in the rest of your script, since you wouldn’t know their names ahead of time when the script is authored.

    Excerpted from MSBuild Trickery, trick #30 which has many pages of additional detail on this manipulation

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

Sidebar

Related Questions

Please read the whole question; I personally think that this is programming-related; if you
Please read the entire question. I have a unique situation with several constraints that
Please read my update at the end of question after reading the answers: I'm
please read carefully because my english is not good, and the question has not
Before jumping on me, please read my question carefully :D. I know there are
(please read the update section below, I leave the original question too for clarity)
Guys before you start down voting me please read this question and please understand
Before someone shouts out the answer, please read the question through. What is the
Please read Update1 first! This is SSIS specific question. I have the following tasks:
--- Edited below with some more testing, please read :) --- I'm struggling trying

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.