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


January 27, 2011

Build with .NET 4.0 in Team Foundation Server

In order to force your Team Build to use the .NET assemblies and tools you'll need to make the following change.

Change the value in the

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\tfsbuildservice.exe.config

From

add key="MSBuildPath" value=""

to

add key="MSBuildPath" value="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319"

TFS service must be restarted afterwards "Visual Studio Team Foundation Build"

http://blogs.infosupport.com/blogs/martijnb/archive/2010/05/04/building-visual-studio-2010-solutions-using-team-build-2008.aspx