Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How i can use BuildMessage in a custom BuildActivity?

How Can I add BuildMessage(s) in custom BuildActivity?

[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"
        };
    }
}

}

For WorklowActivity there is a special WorkflowInvoker...

Thank's a lot.

like image 796
Matthias Meyer Avatar asked Feb 03 '12 17:02

Matthias Meyer


1 Answers

Logging in a CodeActivity can be done using the CodeActivityContext.

Example:

protected override void Execute(CodeActivityContext context)
{
    context.TrackBuildMessage("Hello from Custom TFS Build Activity", BuildMessageImportance.High);
}

TrackBuildMessage is an Extension method which can be found in namespace: Microsoft.TeamFoundation.Build.Workflow.Activities

like image 111
Nick Nieslanik Avatar answered Oct 21 '22 09:10

Nick Nieslanik