2013-10-15

TFS with F# Make

TFS provides a complete .NET SDK. The primary way to customize a build process in TF Build is to modify a Windows Workflow template which is a .xaml file. You can also create Workflow Workflow Activities in .NET code, but both are time consuming, tedious, and not very fun. I thought it would be nice to be able to delegate to FAKE, the F# Make tool.

I just completed a milestone. I was able to have a FAKE build script named build.fsx modify the build label. this demonstrates several things:
  • TF Service + NuGet + FAKE works! :)
  • NuGet 2.7 restore of FAKE works
  • FAKE works with MS Build 12.0
  • FAKE script is able to communicate with TFS
The great thing about FAKE scripts is that they are simply F# scripts. You get full IntelliSense in Visual Studio. A library could be created that has the functionality provided by the TF Build Activities. For now, here is the build.fsx I used:
Loading gist ...

FAKE with NuGet 2.7

NuGet 2.7 Package Restore is great for FAKE. It is simple to install FAKE in a solution using the NuGet Package Manager Console in Visual Studio. I simply leave it where it is in the packages folder and create a build.bat:

packages\FAKE.2.1.309-alpha\tools\FAKE.exe build.fsx %*

I can then use the script to run it locally. Other libraries that the build.fsx needs can be added in the .nuget\packages.config.