You may have noticed that the logging is different between TFS 2005 and TFS 2008. Indeed they have changed the verbosity level of the logging : it was normal for TFS 2005 and it is now diagnostic by default.
How can we control it to reset it to normal?
Simply by changing the value of some parameters that are sent to MSBuild. For that, you can simply edit the "TFSBuild.rsp" file that has been generated with your "TFSBuild.proj" file. See one example below :
# This is a response file for MSBuild
# Add custom MSBuild command line options in this file
# We can control here the "verbosity" level of the logging. The possible values are :
# quiet
# minimal
# normal
# detailed
# diagnostic
/fileloggerparameters:Verbosity=minimal
How can you know the possible switch you can set here and their values ? Simply check the MSBuild help. You can also refer to the blog of Aaron Hallberg and his post about verbosity.
It was possible under Visual Source Safe, but not under TFS 2005.
It has been added in TFS 2008. How to use it ?
tf destroyitemspec
tf destroy $/MyTeamproject/MyItemToDestroy
Few days ago, I was needing to be able to retrieve some informations about the builds we had launched. I was so needing to work with the TFS API.
To do this, you must have Visual Studio and a Team Explorer installed.
-
Create a new application (a console application for example)
-
Add a reference to the DLLs
-
Microsoft.TeamFoundation.Build.Client
-
Microsoft.TeamFoundation.Build.Common
-
Microsoft.TeamFoundation.Client
-
Microsoft.TeamFoundation.Common
You can find these DLLs in the folder "Program Files\Microsoft Visual Studio X.X\Common7\IDE\Private Assemblies
And after you can very simply interrogate the TFS API as for example :
string tfsUrl = "http://YourTFS:8080";
string teamProject = "Your Team Project Name";
string teamBuildType = "The name of your team build";
TeamFoundationServer server = TeamFoundationServerFactory.GetServer(tfsUrl);
BuildStore buildStore = server.GetService(typeof(BuildStore)) as BuildStore;
BuildData[] buildDatas = buildStore.GetListOfBuilds(teamProject, teamBuildType);
foreach ( BuildData buildData in buildDatas )
{
PlatformFlavorData[] platforms = buildStore.GetPlatformFlavorsForBuild(buildData.BuildUri);
foreach ( var platformFlavor in platforms )
{
TestResultData[] testResults = buildStore.GetTestResultsForBuild(buildData.BuildUri, platformFlavor.PlatformName, platformFlavor.FlavorName);
foreach ( TestResultData testResultData in testResults )
{
}
}
}
Quite easy no ?
Juste one things to know : this code will work, whatever the version of your Visual Studio and TFS. But all the class you use here are deprecated under TFS 2008 (but will still work).
So how to do the same thing using the new TFS 2008's classes ? To be seen in a future post ! ;-)