Scope of properties and item in an MSBuild script

Scope of properties and item in an MSBuild script

Some time ago I asked myself what was the scope of properties and items in an MSBuild script specifically when using CallTarget and MSBuild tasks and dynamically modifying those variables. Here are the results of my (long) researches:

What we must know first:

  • Using the CallTarget task is the same as using the MSBuild task with the project $(MSBuildProjectFile). I’ll use the MSBuild task in this post.
  • Internally MSBuild uses an instance of the Project class to represents a script project.

Here is the test script I’m using:

read more →