How i can use BuildMessage in a custom BuildActivity?
Asked Answered
A

1

8

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.

Angle answered 3/2, 2012 at 17:32 Comment(0)
B
15

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

Bigley answered 3/2, 2012 at 18:6 Comment(4)
Hi I am currently trying to show a build message for TFS. But i cannot seem to locate this function, in my CodeActivityContext context i only have a funcction called Track which takes System.Activities.Tracking.CustomTrackingRecordAgonistic
I have found it, didnt do enough google, the function is based down in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies hope this helps someone elseAgonistic
This is an extension method. You need to add a using statement for the namespace Microsoft.TeamFoundation.Build.Workflow.Activities in order to get access to this function.Satinwood
@CharlesLambert This should really be in the answer.Outgoings

© 2022 - 2024 — McMap. All rights reserved.