TFS Check-In Validation Tool
Team Build, Team System 2008 October 21st, 2008
New tool was released on CodePlex called TFS Check-in Validation Tool.
This tool provides the ability to have a checkin validating by a build prior to being checked in. This is similar to a feature in TFS 2010 called Gated Checkin, which is integrated into VS and TFS (more info in this video). With both of these the goal is to prevent build breaks from being checked in by validating them beforehand.
If you really like it and are interested in doing something similar with TFS 2008 (before TFS 2010) comes out, you can check out this new project on CodePlex: http://www.codeplex.com/BuddyBuild.
It is not a part of TFS and the implementation is unrelated to the TFS 2010 Gated checkin feature.
<TestContainer> Works With WebTest & LoadTest In Team Build 2008 With SP1
Team Build, Team System 2008 September 13th, 2008
The new <TestContainer> item in Team Build 2008 in a great way to run tests without test metadata file (*.vsmdi).
You can specify the following to run all unit tests found in assemblies matching the pattern *.Tests.dll and even specify .LoadTest and .WebTest files as well:
<ItemGroup> <TestContainer Include="$(Outdir)*.Tests.dll" /> <TestContainer Include="$(Outdir)WebTest1.webtest" /> <TestContainer Include="$(Outdir)LoadTest1.loadtest" /> </ItemGroup>
But if you try to run it in Team Build 2008, you will get an error like: Could not load file or assembly.
That’s because the task tries to do an Assembly.LoadFrom() on whatever files you include in the <TestContainer> item. This obviously fails because .LoadTest and .WebTest are XML files, not assemblies.
This problem has been solved in TFS 2008 SP1. All you need to do is to apply the TFS SP1 patch to the build machine (If you don’t want, it’s not necessary to install TFS SP1 on TF Server to get the fix).
Team Build and ClickOnce
MSBuild, Team Build September 13th, 2008
The other day I got a question: How can I deploy an app via ClickOnce using Team Build?
There is not out of box way to do that, but we can do it with a simple workaround:
we should overload the target AfterCompile in TFSBuild.Proj to call MSBuild Task Publish and can pass the PublishDir property:
<Target Name="AfterCompile"> <MSBuild Condition=" '@(SolutionToBuild)'!='' " Projects="@(SolutionToBuild)" Properties="Configuration=%(ConfigurationToBuild.FlavorToBuild); Platform=%(ConfigurationToBuild.PlatformToBuild); SkipInvalidConfigurations=true; VCBuildOverride=$(MSBuildProjectDirectory)\TFSBuild.vsprops; FxCopDir=$(FxCopDir);OutDir=$(OutDir); PublishDir=$(OutDir); ReferencePath=$(ReferencePath); TeamBuildConstants=$(TeamBuildConstants); $(CodeAnalysisOption);PublishDir=\\qa1Srv\drops\publishedVers\ " Targets="Publish" /> </Target>
Configure Team Foundation Build for an Incremental Build
Team Build, Team System 2008 June 12th, 2008
A question I got today: “How can I configure my Team Build for an incremental build?”.
So, it’s simple.
Team Build 2005
Add the PropertyGroup definition to the end of the TFSBuild.proj file, before the closing </project> tag.
Set the following properties:
<PropertyGroup> <SkipClean>true</SkipClean> <SkipInitializeWorkspace>true</SkipInitializeWorkspace> <ForceGet>false</ForceGet> </PropertyGroup>
Team Build 2008
Set IncrementalBuild property to true. To do it, add the PropertyGroup definition to the end of the TFSBuild.proj file, before the closing </project> tag.
<PropertyGroup> <IncrementalBuild>true</IncrementalBuild> </PropertyGroup>
Source - msdn:
Team Build 2005: http://msdn.microsoft.com/en-us/library/aa833876(VS.80).aspx
Team Build 2008: http://msdn.microsoft.com/en-us/library/aa833876.aspx
Team Build 2008 Downloads One Level Only
Team Build, Team System 2008 March 29th, 2008
TfsBuild.proj files can be located anywhere in source control in Team Build 2008. That is the reason why MS changed the default recursion type used to download files from the location of TfsBuild.proj to OneLevel only. The meaning is that only the contents of the exact directory of TfsBuild.proj are downloaded.
Aaron Hallberg posted a solution to change this behavior.
We have to modify the following line in the TfsBuildService.exe.config on the build machine:
<add key="ConfigurationFolderRecursionType" value="Full" />
Make sure to restart the service after making the change!
How To: Delete Build Agent In TFS 2008
Team Build, Team System 2008 March 29th, 2008
I’m working on my TechEd demos which includes DB Projs and MSBuild + Team Build .I needed to remove one of my build agents.
To remove a build agent, navigate to to the Build Menu, or the Build Explorer. Click on Manage Build Agents in order to remove/edit/add a build agent.
In order to use the Build Menu, you must first open the Team Explorer. Otherwise, the Manage Build Agents will not be part of the menu.
Remove Items From ItemGroups In MSBuild
MSBuild, Team Build March 25th, 2008
The ability to remove entries from ItemGroups is one of the new features of MSBuild 3.5.
To remove an Item from an ItemGroup in MSBuild 2.0 you would have to create a new ItemGroup from the old one and skip the Item that you needed removed.
In MSBuild 3.5 we can achieve it by using the Remove parameter.
Example:
<ItemGroup> <Files Include="a.cs" /> <Files Include="b.cs" /> <Files Include="c.cs" /> <Files Include="d.cs" /> <Files Include="e.cs" /> <Files Include="f.cs" /> <Files Include="g.cs" /></ItemGroup>
Some times we want to restrict some data from this group in a target. In order to do it, we should use the Remove parameter:
<ItemGroup> <Files Remove="a.cs" /> <Files Remove="e.cs" /> <Files Remove="f.cs" /></ItemGroup>
Read more at msdn.
Running Tests On TFS Build Machine
Team Build, Team System, Team System 2008 March 13th, 2008
Often I asked “What do I need to install on the TFS build machine in order to run tests?”
Well, the answer is simple.
In VSTS 2005 you have to install the Tester or Suite editions on the Build Machine to run tests (even Unit Tests).
In VSTS 2008 installing the Developer Edition version is enough.
Team Build 2008 Property Reference
MSBuild, Team Build, Team System 2008 February 16th, 2008
Aaron Hallberg has posted a great reference to the Team Build 2008 built-in properties.
You can find it at: http://blogs.msdn.com/aaronhallberg/archive/2008/02/12/team-build-2008-property-reference.aspx
TeamBuild 2008 - SetBuildProperties Task
Team Build, Team System 2008 February 1st, 2008
SetBuildProperties task is one of the new tasks that shipped in Team Build 2008. With this task we can modify properties of a BuildDetail object directly from MSBuild’s TfsBuild.proj script.
The SetBuildProperties task is defined in the Microsoft.TeamFoundation.Build.Tasks.VersionControl.dll.
The available properties are:
| Property | Description |
| LabelName | Specifies the label name. |
| DropLocation | Specifies the drop location. (shared folder to which the build account has read/write privileges) |
| Quality | Specifies the build quality. |
| TestStatus | Specifies the test status. Valid values are Succeeded, Failed, and Unknown. |
| Status | Specifies the build status. Valid values are NotStarted, InProgress, Succeeded, PartiallySucceeded, Failed, and Stopped. |
| BuildNumber | Specifies the build number. |
| TeamFoundationServerUrl | Specifies the Team Foundation Server URL. For example, http://MyServer:8080. |
| BuildUri | Specifies the build URI. |
| CompilationStatus | Specifies the compilation status. Valid values are Succeeded, Failed and Unknown. |
Usage:
<SetBuildProperties BuildNumber="$(BuildNumber)" BuildUri="$(BuildUri)" DropLocation="$(DropLocation)" />




