The WriteToFile activity can be used to create your own log files, above and beyond those created by the build process or the tools it runs. In this example we aim to show the the basic steps that are required to get the activity integrated into a build.

Before you can make use of any of the TFS community build activities you have to make sure they are available for the build system and on your development PC. Instructions for this process can be found in the ALM Rangers build guide or in the StyleCop page of this wiki. This page assumes the WriteToFile activity is available in the developers build process workflow toolbox.

Configuring the activity

Using the WriteToFile activity is very straight forward, it can be dropped anywhere onto the build process design surface and only two properties* have to be set (as a minimum) to make it work.

  • AutoNewLine: a boolean if true a newline is written after the content is written using .WriteLine(string). If false, or not set, the content is written using .Write(string)
  • *Content: a string, the string you wish to write e.g. String.Format("An email from build {0}", BuildDetail.BuildNumber)
  • Create: a boolean if true a new file is created (over writing any old file of the same name), if not set or false the content is appended to the existing file (or a new file created if one does not exist)
  • *FileName: the filename to write to e.g. string.Format("{0}\myfile.txt", DropLocation)

Running the activity

When you run a build with this activity the file you wish to created should be written too.

Last edited Mar 30, 2012 at 3:05 PM by rfennell, version 2

Comments

No comments yet.