Home Ask Login Register

Developers Planet

Your answer is one click away!

Lee Englestone February 2016

How do I create, write to and deploy a text file containing build and release information in TFS Release Management?

During a deployment in Release Management Client for Visual Studio 2015 i'd like to

  1. Create a new text file called release.txt
  2. Write to the file the Release Id, Release name, TFS Build number and Date
  3. Deploy this file along with a website

So that I can go to that file at the root of the website and see what version of the codebase is live.

How would I go about doing this?


Daniel Mann February 2016

Write a PowerShell script that takes the parameters you want to capture.

Turn it into a custom Tool that takes those parameters (Arguments would be, for example: -BuildNumber '__Build Number__').

Make a new Component that uses that tool.

Pass in the parameters (e.g. $(BuildNumber))

The system variables you can pass in are:

  • ApplicationPath Destination path, including the component name, where the component is copied.
  • ApplicationPathRoot Destination path where the component is copied. The default is C:\Windows\dtlDownloads. You can over-ride this value to specify an alternative destination path.
  • BuildDefinition Build definition for the component.
  • BuildNumber Build number for the component.
  • Environment The environment for the release.
  • PackageLocation The source path from which the component is copied. For builds dropped to a Standard server, the path points to the container-id. For builds dropped to Azure, the path points to the storage blob GUID.
  • ReleaseId The ID of the release; this is assigned by Release Management.
  • ReleaseNumber The number of the release.
  • Stage The stage of the release.
  • Tag Tag used to group the server which is running the action.
  • TeamProject Team project for the component.
  • TFSUrl TFS URL for the component.

Ref: https://msdn.microsoft.com/en-us/library/dn834972(v=vs.120).aspx

chief7 February 2016

If your using WebDeploy you could add the release info file to your web application with blank/default values and use Parameterization to transform it during your deployment using the SetParam flag on your MSDeploy or deploy.cmd call.

msdeploy.exe -verb:sync -source:package=D:\package.zip -dest:auto,computername=mycompuetrname -setParam:name="ReleaseId",value="$(ReleaseId)" -setParam:name="BuildNumber",value="$(BuildNumber)"

Post Status

Asked in February 2016
Viewed 3,645 times
Voted 9
Answered 2 times


Leave an answer

Quote of the day: live life