如何在自定义BuildActivity中添加BuildMessage?
[BuildActivity(HostEnvironmentOption.Agent)]
public sealed class InvokeDotNetReactor : CodeActivity
{
[RequiredArgument]
public InArgument<string> SourcesDirectory { get; set; }
protected override void Execute(CodeActivityContext context)
{
...
BuildMessage bm = new BuildMessage()
{
Importance = BuildMessageImportance.High,
Message = "Hello From Custom TFS Build Activity"
};
}
}
}
对于WorklowActivity,有一个特殊的WorkflowInvoker ...
非常感谢。
最佳答案
可以使用CodeActivityContext登录CodeActivity。
例:
protected override void Execute(CodeActivityContext context)
{
context.TrackBuildMessage("Hello from Custom TFS Build Activity", BuildMessageImportance.High);
}
TrackBuildMessage
是一种扩展方法,可以在命名空间中找到:Microsoft.TeamFoundation.Build.Workflow.Activities