How to debug build break in Team Build?
Increasing the verbosity of logger
Team build invokes logger with normal verbosity. It is done to avoid showing unnecessary details about build in the log file and make it more readable. Sometime when you introduce custom tasks or there is some regression in the existing code, it becomes hard to figure out the problem.
Normal verbosity does not give much details and you might want to have detailed log of exact sequence of events/tasks/targets that resulted in failure. You can increase the verbosity of the logger by doing the following steps
- check-out TFSBuild.rsp file corresponding to your BuildType (you will find this file at the same location as TFSBuild.proj)
- add /v:diagnostic to rsp file
- check-in the rsp file.
The rsp file will be passed by the Build Service to the msbuild command and all the attached loggers will start logging with full verbosity. Now your build log will have the value of all the msbuild properties, items, exact order in which targets and tasks were invoked, the value of conditions, etc.
Invoking specific target with team build
Ok, now you have identified the target/task that is not working correctly. You want to invoke the given target with exactly the same arguments to get the repro. First you have to get the build arguments You can do that by enabling the build machine service logging. The steps are
- start --> run --> service.msc
- stop “team build service”
- open %Program Files%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\TfsBuildService.exe.config
- uncomment the following lines to enable logging. You can also specify the location of buildmachine.log file
<!--
<system.diagnostics>
<switches>
<add name="API" value="4" />
<add name="Authentication" value="4" />
<add name="Database" value="4" />
<add name="General" value="4" />
</switches>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="c:\logs\buildmachine.log" />
</listeners>
</trace>
</system.diagnostics>
- ->
- make sure that folder where the log file will be created exists
- make sure that folder pointed by “initializeData” exists
- start “team build service”
After invoking another build, you can open the buildmachine.log file to get the msbuild arguments for that specific invocation. You can find the arguments by searching for tag “Build arguments:”. For example you will have something like
Build arguments:
- /nologo
- /p:PortfolioProject="MyDummyProj"
- /p:TeamProject="MyDummyProj"
- /p:BuildType="MyBuildType"
- /p:DropLocation=\\<MachineName>\droplocation
- /p:BuildDirectoryPath="c:\buildlocation"
- /p:TeamFoundationServerUrl=https://<ServerName>:8080
- /p:IsDesktopBuild="false"
- /p:FxCopDir="C:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\"
- /p:TeamBuildRefPath="C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies"
- /p:LastBuildNumber="MyBuildType_20050803.3"
- /p:LastGoodBuildNumber="MyBuildType_20050803.3"
- /p:BuildNumber="MyBuildType_20050803.4"
- /p:ToolSpecificId="08032005_084015_57743"
- /p:BuildURI=vstfs:///Build/Build/08032005_084015_57743
- /p:ConfigurationFileURI="vstfs:///VersionControl/VersionedItem/MyDummyProj%252fTeamBuildTypes%252fMyBuildType%252fTFSBuild.proj%2526changesetVersion%253d16%2526deletionId%253d0"
- /logger:BuildLogger,"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Build.Server.Logger.dll";"BuildURI=vstfs:///Build/Build/08032005_084015_57743;PortfolioProject=MyDummyProj;TFServer=https://<ServerName>:8080;ServerUICulture=1033;" /logger:FileLogger,Microsoft.Build.Engine;logfile=BuildLog.txt;encoding=Unicode; /noconsolelogger
- /t:EndToEndIteration
- TFSBuild.proj
- @TFSBuild.rsp
You can run the msbuild command with the appropriate arguments on the command line. If you are debugging the specific task or target it is recommended to not pass any logger (i.e do not pass 17th argument in the list). If you want to run specific target you can pass the name of target using /t switch (18th argument). You are also responsible for make sure that all the prerequisites of the target are executed properly. For example before invoking "Get" task, you have to make sure that "CreateWorkspace" task has already created proper workspace. Please note that this is different from Desktop build and you should not set the "IsDeskTopBuild" flag to true. Setting desktop flag to true might result in skipping the target.
Do drop a line if you need additional information ...
Disclaimer: The information mentioned is for beta3 bits (releasing in September 2005).
Comments
Anonymous
August 10, 2005
Yeah, I'm behind, so some of these are old.
Ian Hu - Profiler Improvements In July CTP of VSTS
...Anonymous
December 07, 2006
decimetre Berlin http://www.mybbhotel.info/utilization_France/twilit_Ile%20de%20France/decimetre_Paris_1.htmlAnonymous
January 29, 2007
suffuse Florence http://www.allbestjobs.info/judge_Italy/sordid_Lombardia/suffuse_Milan_1.htmlAnonymous
March 28, 2007
ongoing Leipzig http://www.jobzworks.info/shrank_Germany/intellect_Rheinland-Pfalz/ongoing_Cochem_1.htmlAnonymous
March 28, 2007
entrancing D%C3%83%C2%BCsseldorf http://www.easytaskz.info/diocese_Germany/erupt_Nordrhein-Westfalen/entrancing_Cologne_1.htmlAnonymous
August 14, 2007
I disagree go to http://apartments.waw.pl/Anonymous
September 12, 2008
PingBack from http://alipka.wordpress.com/2006/03/19/tfsmsbuild-caveats/