Now it is time to expand our build process to their own activities. Here is a very small activity to write messages in the build-process-output window.
First we need a new workflow library project.
We then create a new Activity code within the workflow project.
1: using System.Activities;
2: using Microsoft.TeamFoundation.Build.Client;
3: using Microsoft.TeamFoundation.Build.Workflow . Activities;
4:
5: namespace DeployActivities
6: {
7:
8: [BuildActivity(HostEnvironmentOption.All)]
9: [BuildExtension(HostEnvironmentOption.All)]
10: public sealed class ExecuteSql : CodeActivity
11: {
12: [RequiredArgument]
13: public InArgument<IBuildDetail> BuildDetail { get; set; }
14: [RequiredArgument]
15: public InArgument< string > Message { get; set; }
16:
17: protected override void Execute(CodeActivityContext context)
18: {
19: var message = context.GetValue ( this message.)
20: context.TrackBuildMessage (message);
21:}
22:}
23: }
The main elements are highlighted in yellow below.
For the steps that they reference the following assemblies:
- C: \\ Program Files (x86) \\ Microsoft Visual Studio 10.0 \\ Common7 \\ IDE \\ Reference Assemblies \\ v2.0 \\ Microsoft.TeamFoundation.Build.Client.dll
- C: \\ Program Files (x86) \\ Microsoft Visual Studio 10.0 \\ Common7 \\ IDE \\ Private Assemblies \\ Microsoft.TeamFoundation.Build.Workflow.dll
- C: \\ Program Files (x86) \\ Microsoft Visual Studio 10.0 \\ Common7 \\ IDE \\ Reference Assemblies \\ v2.0 \\ Microsoft.TeamFoundation.Client.dll
- C: \\ Program Files (x86) \\ Microsoft Visual Studio 10.0 \\ Common7 \\ IDE \\ Reference Assemblies \\ v2.0 \\ Microsoft.TeamFoundation.VersionControl.Client.dll
created a build of the project now our assembly with our custom activity.
To use our new activity now, we have used the build process is now in the template you just created Workflow project and invite ausschecken. The Assembly should have just created in order to be available later in workflow process, also copied to the Check-Out directory and later in the build process templates folder of the TFS source control system are checked.
Since the generated assembly is not in the GAC of the build server and agents is an added reference to the assemblies is necessary. The path to build the custom workflow assemblies is further adjusted in the build controller. The assemblies in the GAC or have checked into the source control system are located.
After the build process template used in the Workflow Designer opens, I get my activity by Drag'n drop in the workflow process.
Since also the built assembly in the GAC not the build server and build Agents is, is a (sadly) reference manual in the workflow XAML file necessary.
xmlns: local = "clr-namespace: DeployActivities; assembly = \u0026lt; AssemblyName >
Now is a workflow execution over the Team Build Explorer in the way of.
The log of the build we find the following additional output.