Search code examples
msbuildmsbuild-task

MSBuild Task and passing properties


When the MSBuild task is used, is anything inherited from the current context?

What's the difference between the Properties and AdditionalProperties metadata? The example and description in the docs is exactly the same.

(I'm using MSBuild 4, as with VS2010)


Solution

  • The answer is found using Google instead of Bing :) Sayed Ibrahim Hashimi notes,

    Like I said previously there are two new ways to pass properties in item metadata, Properties and AdditionalProperties. The difference can be confusing and very problematic if used incorrectly. Admittedly I didn't know the difference until about 6 months ago (but soon enough to include in my book ☺ ). The difference is that if you specify properties using the Properties metadata then any properties defined using the Properties attribute on the MSBuild Task will be ignored. In contrast to that if you use the AdditionalProperties metadata then both values will be used, with a preference going to the AdditionalProperties values.

    Now let's take a look at an example to make this clear. ⋯