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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:01:18+00:00 2026-06-09T13:01:18+00:00

This seems like an obvious thing to want to do but I have pulled

  • 0

This seems like an obvious thing to want to do but I have pulled most of my hair out trying to find any examples on the web or do it myself.

I have a c# solution with 19 projects and a Jenkins build server running a build script to drive MSBuild. MSBuild will of course determine what does and does not need to be compiled based on inputs versus outputs.

I am trying to create a custom target to conditionally update the AssemblyInfo.cs of those projects MSBuild is going to compile to increment the file versions. Of course I want to leave the projects not being compiled alone.

I know how to inject a target prior to the CoreBuild that runs every time so if there is some variable I can test to see if a compile will occur that can work. I also know how to determine if a compile ran and therefore conditionally do some post processing which is possible but not ideal.

How can I tweak my build process to achieve this?

Since it seems there’s no straight answer to the question, does anyone know how to perform the same logic as MSBuild to determine what projects require a rebuild?

  • 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-09T13:01:19+00:00Added an answer on June 9, 2026 at 1:01 pm

    In the end the solution was a combination of Sayed Ibrahim Hashimi’s blog entry and information from the MSDN Forum entry ‘Execute target when (core)compile will execute’.

    I basically took Sayed’s injection method to get my target to run ‘extend-corecompile.proj’ on all projects without having to edit each proj file but replaced it’s contents with an override for ‘CoreCompileDependsOn’ that points to a custom target that adopts the same inputs and outputs as the ‘CoreCompile’ target. The end result is a target that only runs when ‘CoreCompile’ will run while being centrally managed in the build script.

    Thanks to all for their input and here is the skeleton code I used in ‘extend-corecompile.proj’:

    <!--The following property group adds our custom post-target to the post compile call list -->
    <PropertyGroup>
        <TargetsTriggeredByCompilation>
            $(TargetsTriggeredByCompilation);
            CustomPostTarget
        </TargetsTriggeredByCompilation>
    </PropertyGroup>
    
    <!--The following property group adds our custom pre-target to CoreCompileDependsOn to ensure it is called before CoreCompile -->
    <PropertyGroup>
        <CoreCompileDependsOn>
            $(CoreCompileDependsOn);
            CustomPreTarget
        </CoreCompileDependsOn>
    </PropertyGroup>
    
    <!-- The following custom pre-target has the same inputs and outputs as CoreCompile so that it will only run when CoreCompile runs.
        Because we have injected this file and Targets are resolved in sequence we know this Target will fire before CoreCompile.-->
    <Target Name="CustomPreTarget" 
        Inputs="$(MSBuildAllProjects);
                @(Compile);                               
                @(_CoreCompileResourceInputs);
                $(ApplicationIcon);
                $(AssemblyOriginatorKeyFile);
                @(ReferencePath);
                @(CompiledLicenseFile);
                @(EmbeddedDocumentation); 
                $(Win32Resource);
                $(Win32Manifest);
                @(CustomAdditionalCompileInputs)"
        Outputs="@(DocFileItem);
                 @(IntermediateAssembly);
                 @(_DebugSymbolsIntermediatePath);                 
                 $(NonExistentFile);
                 @(CustomAdditionalCompileOutputs)">
        <!--Do pre-compilation processing here-->
    </Target>
    
    <!--This target will be called by CoreCompile-->
    <Target Name="CustomPostTarget" >
        <!--Do post-compilation processing here-->
    </Target>
    

    Not sure what will happen if CoreCompile fails, does it still call our target? I guess in time we’ll find out 🙂

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

Sidebar

Related Questions

It seems like such a simple thing, but I can't find any obvious solutions...
This seems like it should be obvious but I can't figure it out. Suppose
This may seem like an obvious thing, but I can't find it. When using
This seems like a fairly obvious question, but I haven't been able to think
This seems like I'm missing something obvious but I can't get redirects (>) to
Seems like this should be obvious, but how do I send arrow key presses
This might sound like an obvious question but I can't seem to find the
This seems like such a simple issue but I cannot find an elegant solution.
This seems like the simplest Git question, but I can't find ANYTHING on it.
This seems like a pretty obvious, basic thing to expect from the Graph API

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.