MSBuild and Workflow Foundation

I am in the process of investigating how to create a FTP Task to be used in the TFS Build Engine.  This post is about creating a MSBuild task, kicking it off, and then integrating WF into that task. 

Using this MSDN article, I crated a basic task like so:

using System; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; namespace Tff.FtpTask { public class PublishWebsite: Task { public override bool Execute() { return true; } } }

I then created a build file like so:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Target Name="PublishWebsite"> <PublishWebsite /> </Target> </Project>

When I ran it:

image

The build file is not finding the task I created. I altered the build file like this:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <UsingTask TaskName="PublishWebsite" AssemblyFile="C:\Users\Jamie\Documents\Visual Studio 2010\Projects\Tff.FtpTask\Tff.FtpTask\bin\Debug\Tff.FtpTask.dll" /> <Target Name="PublishWebsite"> <PublishWebsite /> </Target> </Project>

And pop goes the fire cracker:

image

I then added in a workflow to the project:

image

Called the workflow:

public override bool Execute() { WorkflowInvoker.Invoke(new PublishWebsite()); return true; }

And Bang!  That was pretty straight forward.

image

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: