Welcome to MSDN Blogs Sign in | Join | Help

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

  1. check-out TFSBuild.rsp file corresponding to your BuildType (you will find this file at the same location as TFSBuild.proj)
  2. add /v:diagnostic to rsp file
  3. 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:

  1. /nologo 
  2. /p:PortfolioProject="MyDummyProj"
  3. /p:TeamProject="MyDummyProj"
  4. /p:BuildType="MyBuildType"
  5. /p:BuildDirectoryPath="c:\buildlocation"
  6. /p:TeamFoundationServerUrl=http://<ServerName>:8080
  7. /p:IsDesktopBuild="false"
  8. /p:FxCopDir="C:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\"
  9. /p:TeamBuildRefPath="C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies"
  10. /p:LastBuildNumber="MyBuildType_20050803.3"
  11. /p:LastGoodBuildNumber="MyBuildType_20050803.3"
  12. /p:BuildNumber="MyBuildType_20050803.4"
  13. /p:ToolSpecificId="08032005_084015_57743"
  14. /p:BuildURI=vstfs:///Build/Build/08032005_084015_57743
  15.  /p:ConfigurationFileURI="vstfs:///VersionControl/VersionedItem/MyDummyProj%252fTeamBuildTypes%252fMyBuildType%252fTFSBuild.proj%2526changesetVersion%253d16%2526deletionId%253d0"
  16. /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=http://<ServerName>:8080;ServerUICulture=1033;" /logger:FileLogger,Microsoft.Build.Engine;logfile=BuildLog.txt;encoding=Unicode; /noconsolelogger
  17. /t:EndToEndIteration  
  18. TFSBuild.proj
  19. @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).  

Published Thursday, August 04, 2005 1:55 PM by ManishAgarwal

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# VSTS Links - 8/10/2005

Yeah, I'm behind, so some of these are old.

Ian Hu - Profiler Improvements In July CTP of VSTS
...
Wednesday, August 10, 2005 4:30 PM by Team System News

# decimetre Berlin

Thursday, December 07, 2006 6:19 PM by decimetre Berlin

# suffuse Florence

Tuesday, January 30, 2007 3:31 AM by suffuse Florence

# ongoing Leipzig

Wednesday, March 28, 2007 10:56 AM by ongoing Leipzig

# entrancing D%C3%83%C2%BCsseldorf

Thursday, March 29, 2007 4:32 AM by entrancing D%C3%83%C2%BCsseldorf

# I disagree

I disagree go to http://apartments.waw.pl/

Tuesday, August 14, 2007 4:38 PM by warsaw hotels

# TFS/MSBuild caveats &laquo; Andrzej&#8217;s Weblog

Friday, September 12, 2008 9:16 AM by TFS/MSBuild caveats &laquo; Andrzej&#8217;s Weblog

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker