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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:07:08+00:00 2026-05-27T21:07:08+00:00

I have defined several AfterBuild – Tasks in my Visual Studio project with different

  • 0

I have defined several AfterBuild – Tasks in my Visual Studio project with different conditions:

<Target Name="AfterBuild" Condition="'$(Configuration)'=='FinalBuilder'">
    <Message Importance="high" Text="--- AfterBuild for FinalBuilder ---" />
</Target>
<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    <Message Importance="high" Text="--- AfterBuild for MvcBuildViews ---" />
</Target>

But only the last one is executed if the condition match. If I choose the FinalBuilder-Configuration, the AfterBuild tasks is ignored and not executed. If I change the order of the Targets in the project files (Condition=”‘$(Configuration)’==’FinalBuilder'” as last one), the AfterBuild for FinalBuilder-Configuration is executed but the one for MvcBuildViews is ignored.

Is the order of the target important? Is only the last AfterBuild task taken into account? Or how can I define different AfterBuild tasks with different Conditions?

Thanks

Konrad

  • 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-27T21:07:09+00:00Added an answer on May 27, 2026 at 9:07 pm

    The only second one is executed because it was redefined. See MSDN (Declaring targets in the project file chapter).

    You should use only one AfterBuild target in your project file like this:

    <Target Name="AfterBuild" >
        <Message Condition="'$(MvcBuildViews)'=='true'" Importance="high" Text="--- AfterBuild for MvcBuildViews ---" />
        <Message Condition="'$(Configuration)'=='FinalBuilder'" Importance="high" Text="--- AfterBuild for FinalBuilder ---" />
    </Target> 
    

    EDIT:
    Or use CallTarget task:

    <Target Name="AfterBuild" >
        <CallTarget Condition="'$(MvcBuildViews)'=='true'" Targets="MvcBuildTarget" />
        <CallTarget Condition="'$(Configuration)'=='FinalBuilder'" Targets="FinalBuilderTarget" />
    </Target> 
    
    <Target Name="MvcBuildTarget">
        <Message Importance="high" Text="--- AfterBuild for MvcBuildViews ---" />
    </Target> 
    
    <Target Name="FinalBuilderTarget" >
        <Message Importance="high" Text="--- AfterBuild for FinalBuilder ---" />
    </Target> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several constant defined for a webservice, and I would like to make
This issue is driving me mad. I have several tables defined, and CRUD stored
I'm working on a java program, and I have several vectors defined and filled
I have several existing XML schema files with a defined data model. I would
We have a service account defined for anonymous access which is used for several
I have sevevral custom actions as part of an MSI project, defined in vS2008.
I have an iVar named, int DATA_IN_TRANSIT; and I have defined several macros, e.g.
I have a route defined with several hardcoded (non-parameter) segments: routes.MapRoute(null, suggestion/list/by/{tag}, new {
I have defined a ImageButton as being drawn by a selector (which uses several
I have an Ext.grid.EditorGridPanel in which I defined several columns. Per each of the

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.