MSBuild Custom Task and TFS
January 4, 2011 Leave a comment
I tried to kick off the a custom build task using TFS like so:
The .csproj has 1 file:
And the 1 class has the following code:
using System; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; namespace Com.Tff.Carpool.Build { public class PublishWebSite : Task { public override bool Execute() { return true; } } }
However, the build just hangs:
I then realized I never included the Build in the .csproj definition. I unloaded the project and added the following line of code:
I then reloaded the project and it still just hanged. I then realized that my Build Controller was not running <sound of me slapping my head />
Once I started the build controller, the job kicked off and ran:
I then added the workflow from this previous post to the Build and it ran. I then went to the build definition’s Process tab and realized I was using the Default template:
It seems to me that the path of least resistance would be to have a couple of WF tasks in the Template that takes the website and FTP it out. I would do this versus creating a new project that has the workflow and then has to find the files in the drop folder. Therefore, no MSBUild tasks.
I first created a new template based on the default:
Note that I have to manually add the template to source control:
I then double clicked on it to alter the definition- and waited 15 seconds for the screen to refresh – holy cow this workflow is a beast!
I want to add 1 task at the end – ftp contents to a remote directory. I wonder how I am going to unit test this. I realized that I need to create the FTP Workflow in a different project, test it, and then move it over into this template. That will be the subject of my next post.