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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:24:14+00:00 2026-06-17T09:24:14+00:00

I have a project files collection: <ItemGroup> <ApplicationToDeploy Include=Frontend.WebSite.csproj;11.WebServices.csproj;22.WebServices.csproj/> <ApplicationToDeploy Include=33.WebServices.csproj;44.WebServices.csproj;Workflow55Svc.csproj/> </ItemGroup> I’m trying

  • 0

I have a project files collection:

<ItemGroup>
  <ApplicationToDeploy
    Include="Frontend.WebSite.csproj;11.WebServices.csproj;22.WebServices.csproj"/>
  <ApplicationToDeploy
    Include="33.WebServices.csproj;44.WebServices.csproj;Workflow55Svc.csproj"/>
</ItemGroup>

I’m trying to get collection of .config-files of these projects:

<Target Name="111">
  <PropertyGroup>
    <Cfgs>@(ApplicationToDeploy->'%(RootDir)%(Directory)*.config')</Cfgs>
  </PropertyGroup>

  <ItemGroup>
    <InputConfigs Include="$(Cfgs)" />
  </ItemGroup>

  <Message Text="Cfgs: @(InputConfigs)"/>
</Target>

Inside the Target block all works fine (I see collection of Web.Configs, App.Configs, Log4net.Configs etc.):

Cfgs: C:\Sources\WebServices\11\WebServices\11.WebServices\Web.config;C:\Sources\WebServices\22\WebServices\22.WebServices\web.log4net.config;C:\Sources\WebServices\33\WebServices\33.WebServices\web.environment.config

But I want to initialize this ItemGroup outside of the Target block. Like this:

<PropertyGroup>
  <Cfgs>@(ApplicationToDeploy->'%(RootDir)%(Directory)*.config')</Cfgs>
</PropertyGroup>

<ItemGroup>
  <InputConfigs Include="$(Cfgs)" />
</ItemGroup>

<Target Name="111">
  <Message Text="Cfgs: @(InputConfigs)"/>
</Target>

And when I do this outside of the Target block I get this:

Cfgs: C:\Sources\WebServices\11\WebServices\11.WebServices\*.config;C:\Sources\WebServices\22\WebServices\22.WebServices\*.config;C:\Sources\WebServices\33\WebServices\33.WebServices\*.config

I don’t understand what’s happens. Is it possible to get the same result outside Target block?

  • 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-17T09:24:15+00:00Added an answer on June 17, 2026 at 9:24 am

    I don’t understand what’s happens.

    This behavior is an effect of the MSBuild evaluation order:

    During the evaluation phase of a build:

    • Properties are defined and modified in the order in which they
      appear. Property functions are executed. Property values in the form
      $(PropertyName) are expanded within expressions. The property value
      is set to the expanded expression.
    • Item definitions are defined and modified in the order in which they appear. Property functions have already been expanded within expressions. Metadata values are set to the expanded expressions.
    • Item types are defined and modified in the order in which they appear. Item values in the form @(ItemType) are expanded. Item transformations are also expanded. Property functions and values have already been expanded within expressions. The item list and metadata values are set to the expanded expressions.

    During the execution phase of a build:

    • Properties and items that are defined within targets
      are evaluated together in the order in which they appear. Property
      functions are executed and property values are expanded within
      expressions. Item values and item transformations are also expanded.
      The property values, item type values, and metadata values are set to
      the expanded expressions.”

    There’s another key point on that link “(…) The string expansion is dependent on the build phase.”.

    You’re using the property ‘Cfgs’ to recursively map your projects’ folders AND to define a wildcard to config files (*.config). When you define ‘Cfgs’ INSIDE the target, the InputConfigs receives the expanded value of Cfgs (semicolon-separated string list of folders), and just resolve the wildcards. On the other hand, when you define ‘Cfgs’ OUTSIDE the target, the InputConfigs receives the unexpanded value of Cfgs (@(ApplicationToDeploy->'%(RootDir)%(Directory)*.cs'). When the InputConfigs expands it, it results on the semicolon-separated string list of folders, but it doesn’t resolve the wildcards (*.config).

    Is it possible to get the same result outside Target block?

    I think that InputConfigs should always receive the expanded list of directories. The expansion is made during the execution phase of the build. During this phase, only
    properties and items defined within targets are evaluated. So, I would keep all the initialization inside an ‘Initialization’ Target block. I don’t mean it is impossible to do it outside a Target block, but for the reasons mentioned it does not seems logical. =]

    Hope this helps,

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

Sidebar

Related Questions

I have a Silverlight 3 project with something like this: <ItemGroup> <Content Include=Content\image1.png> </Content>
I have a collection of files that represent a project (txt, cfg, hand edited
I have a collection of csproj files that all refer to the same set
I have a project containing files generated from a .g file (antlr 2.7.x). The
Is it possible to have multiple Qt project files in a single Eclipse project?
We have the problem that we have the open project files in our SVN
I have a project and two files in the project are named as query-structures.h
I have project asp.net with namespace test and I'm using resources (files Resource.resx and
I have notices following: if I have a project with minimum files in res
I have a project with several CSS files, each with many different settings. Every

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.