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=""> <Target Name="PublishWebsite"> <PublishWebsite /> </Target> </Project>

When I ran it:


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

<Project xmlns=""> <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:


I then added in a workflow to the project:


Called the workflow:

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

And Bang!  That was pretty straight forward.



Leave a Reply

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

You are commenting using your 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: