Вопрос

The msbuild contains output tag. It has avialable attributes: TaskParameter and PropertyName, ItemName. How they can be used? What are they containing? Please, can you help me to understand and give an example? For example you can use xmlpeek task with output tag inside. (I read documentation on msdn but I still don't get it. :( )

Это было полезно?

Решение

These are a way of passing values back from the task to the MSBuild script. It is basically a way of mapping a property in the compiled task code that has been decorated with the [Output] attribute back to a property in your MSBuild file. This page gives you more details about it: MSDN: Output Element (MSBuild). This article also has a good example of it in action: How to auto-increment assembly version using a custom MSBuild task

Другие советы

The question has been answered, but I will follow up with an example.

In the MSBuild community task Time, an output parameter Month can be set to a property called CurrentMonth as follows:

<Time>
  <Output TaskParameter="Month" PropertyName="CurrentMonth" />
</Time>

In the MSBuild Community task time source code the property Month inside the Time class looks like this:

[Output]
public string Month
{ 
  get { return month; }
}

All properties mapped with an [Output] attribute can be set as a task parameter and assigned a MSBuild property name as specified above.

To read more about the Time task, a CHM file is available in the MSI file available at the following URL: http://msbuildtasks.tigris.org/

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top