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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:06:08+00:00 2026-05-30T13:06:08+00:00

I have a project structure that looks like this: Parent — ChildProjects1 — ChildProjects2

  • 0

I have a project structure that looks like this:

Parent
— ChildProjects1
— ChildProjects2
— ChildProjects3

I have an msbuild file under each ChildProjects node that builds the relevant projects, creates zip files, tags them in subversion etc

However most of this logic is common between ChildProjects. I’m wondering if I can refactor this common logic to sit in another msbuild file at the parent level and have each child inherit this?

Any ideas on this 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-05-30T13:06:09+00:00Added an answer on May 30, 2026 at 1:06 pm

    You can put common Targets inside an a file that you include using the following syntax, you will also see it in your proj files:

    <Import Project="path to file.targets"/>
    

    Things to note:

    • The convention is to use a .targets extension but it doesn’t matter.
    • Where you place the import is important depending on if you want to be able to override properties or targets in the imported targets file.
    • Targets are not like methods, you cannot call them more than once but you can influence the order in which they are called.
    • If you require reusable chunks that you want to call multiple times create a custom task library but check out the MSBuildExtensionPack first to see if it has what you want.

    Call Target

    In relation to the question about CallTarget. CallTarget will invoke the specified target(s) the same way that DependsOnTargets, BeforeTargets and AfterTargets do. The target will only be run if it has not already been run. See the following example:

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Foo">
    
      <Target Name="Foo" DependsOnTargets="Bar"> 
        <Message Text="Foo" />
        <CallTarget Targets="Bar" />
        <CallTarget Targets="Bar" />
      </Target>
    
      <Target Name="Bar" AfterTargets="Foo" BeforeTargets="Foo">
        <Message Text="Bar" />
      </Target>
    
    </Project>
    

    Which will output the following:

    Microsoft (R) Build Engine version 4.0.30319.17929
    [Microsoft .NET Framework, version 4.0.30319.18449]
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    Build started 24/02/2014 12:06:59.
    Project "D:\Dev\Test.proj" on node 1 (default targets).
    Bar:
      Bar
    Foo:
      Foo
    Done Building Project "D:\Dev\Test.proj" (default targets).
    
    
    Build succeeded.
        0 Warning(s)
        0 Error(s)
    
    Time Elapsed 00:00:00.69
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file structure that looks something like this: project1_root/ tests/ ... src/
I have a directory structure that looks like this: project/ __init__.py foo/ __init.py__ first.py
I have a project with a directory structure that looks like: /foo/baz/__init__.py /bar/foo.py /bar/splat.py
I have a structure that looks like this: <div class=project_group> <table> <tr style=display:none> <td>...</td>
I have a TFS structure that looks something like this: $ -MainSoftwareBranch -Dev -Main
I have a project structure that looks like the following: [Solution Name] doc (documentation)
I have an existing table structure that looks something like this: AnimalTable ------------- |Id
I have a project with a structure like this: project code art config Art
I am new to DDD. In my mini-project, I have a structure that looks
I have a project structure like: src/CMakeLists.txt src/test/component1/CMakeLists.txt src/test/component2/CMakeLists.txt For the testing, I'm using

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.