我有一个输出参数的任务:
List<Resas> ls = revList.Select(x => new Resas() {
profiles = new List<profiles>() {
new profiles {
action = x.todo,
lastName = x.lastName
}
}
).ToList();
我在另一个项目中执行此任务:
public class HelloWorld
: Task
{
[Output]
public string Message { get; set; }
public override bool Execute()
{
Log.LogWarning("HelloWorld task entry");
Log.LogWarning("Setting 'Message'");
this.Message = "Hello World!";
Log.LogWarning("Set 'Message' to '{0}'", this.Message);
Log.LogWarning("HelloWorld task exit");
return true;
}
}
这是构建输出:
警告:HelloWorld任务条目
警告:设置&#39;消息&#39;
警告:设置&#39;消息&#39;来自“你好世界”!&#39;
警告:HelloWorld任务退出
警告:HelloWorld任务已完成
警告:消息:
为什么<UsingTask TaskName="HelloWorld" AssemblyFile="path to dll" />
<Target Name="BeforeBuild">
<HelloWorld>
<Output TaskParameter="Message" PropertyName="Message" />
</HelloWorld>
<Warning Text="HelloWorld task has finished" />
<Warning Text="Message: @(Message)" />
</Target>
输出参数为空?