January 28, 2011

TFSbuild custom parameters and Testing

To test your Team Build Project locally with TFSBuild use the Visual Studio 2010 command prompt.
here's a sample
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>TFSBuild start /collectio
n:http://MYSERVER:8080 /builddefinition:"MYTFS/TestBuild" /droplocation:"\\
SOMECOMPUTER\SOMEDIRECTORY"


However firstly I recommend testing the syntax of your project with MsBuild
e.g.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>msbuild C:\SOMEDIR\TeamBui
ldTypes\MsBuildSamples\TFSBuild.proj


In order to tell msbuild to run a particular target within use something like
C:\MsBuildSamples>msbuild TfsBuild.proj /t:DesktopRebuild
this will run the Target "DesktopRebuild".


Passing Parameters/Arguments

To use parameters passed in through TFSbuild it's simple, just pass in your argument with the /property switch on the command line or do it through the Visual Studio Team Build UI.
this can first be tested with MSBuild
e.g.
C:\TeamBuildTypes\MsBuildSamples>msbuild TfsBuild.proj /t:DesktopRebuild
/property:MyArgument=2

inside in your TfsBuild.proj tjos argument can used anywhere with the syntax $(MyArgument)

And further test with TFSBuild from the command line
C:\Topoix\TeamBuildTypes\MsBuildSamples>TFSBuild start /collection:http://offaly
:8080 /builddefinition:"Topoix-scrum/TestBuild" /droplocation:"\\dunnacarraige\b
uildDrops" /msbuildarguments:"/p:MyArgument=2"

These same msbuildarguments can be passed in through the Visual Studio Queue Build dialog in the "MSBuild command line arguments" panel with
/p:MyArgument=2


No comments: