Easily Debugging Custom Work Item Controls

17 06 2009

I’ve been doing a bit of work recently to create custom work item controls. Debugging these is tricky but you can make two configuration changes to make debugging these as easy as debugging any executable.

The first change is to configure your custom work item controls project to copy its outputs to the directory where Visual Studio Team System 2008 will look for them. To do this:

  1. Open the project properties.
  2. Switch to the Compile tab.
  3. Click Build Events.
  4. In the Post-Build Event Command Line enter:
    copy /Y "$(TargetDir)*.*" "$(UserProfile)\AppData\Local\Microsoft\Team Foundation\Work Item Tracking\Custom Controls\9.0\"

This will copy the contents of the project’s output directory to the directory where Visual Studio Team System 2008 looks for custom controls. This uses the user’s profile directory instead of the all user’s profile because writing to the user’s profile doesn’t require administrative privileges.

The second change is to configure the project to launch Visual Studio as the process to debug. To do this:

  1. Open the project properties.
  2. Switch to the Debug tab.
  3. Select Start External Program.
  4. Browse to devenv.exe (usually C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe).

Now, when you press F5 your custom controls project will be compiled, the output copied to the directory where Visual Studio Team System looks for custom controls, and then Visual Studio Team System 2008 will be launched with the debugger attached. This will give you full debugging capability including breakpoints.





Build Automation and Complexity

8 06 2009

Siva Jagadeesan has blogged that the best approach to automate a complex manual process (and his example was a build process) is to simplify the process before trying to automate it.

This is an approach that I’ve always pushed, and to take this a step further I argue that you can’t optimise or automate a process that you haven’t defined. This is embodied in CMMI insofar as a process area cannot reach the optimizing (Level 5) maturity level without reaching the defined (Level 3) maturity level.

The process optimisation process I normally apply is:

  1. Define the manual process.
  2. Simplify/optimise the manual process.
  3. Automate the manual process.




Writing Custom Activities (aka Tasks) for Team Build 2010

2 06 2009

Aaron Hallberg has posted the first of a few posts on how to write custom activities (aka Tasks) for Team Build 2010 Beta 1, if you ever wrote custom MSBuild Tasks, or thought about it then this post is a critical read to get you up to speed.

In Team Build 2010 the orchestration of the build process is done using Workflow Foundation instead of MSBuild. For those MSBuild lovers of you out there, don’t fret, the actual building of projects is still done with MSBuild and you can invoke any MSBuild projects you want from your workflow.

http://blogs.msdn.com/aaronhallberg/archive/2009/06/01/writing-custom-activities-for-tfs-build-2010-beta-1.aspx





Test and Lab Tool Names Revealed

13 05 2009

Jason Zander has revealed the test and lab tool names:

Visual Studio® Team Test 2010
Support for the specialist tester including Web and load testing capabilities in addition to the ability to create automated test suites.  Executes in the Visual Studio environment for test professionals.  Comes with Microsoft Test and Lab Manager.

Visual Studio® Team Test 2010 Essentials
Support for the generalist tester including the ability to manage test cases and manual/automated test execution.  Installs as a scaled down product for easy access on test machines.

Visual Studio® Lab Management 2010
Support for creating virtualized environments with snapshot capabilities.  You can now execute your tests using the lab capabilities and save the state later for both development and test usage.





May is Build Month on TeamSystemLive.com

6 05 2009

Once a week during May I’ll be doing a 15 minute build-related demo via LiveMeeting on TeamSystemLive.com. Following this I and fellow MVPs Chris Tullier and D. Omar Villarreal will be hosting a 45 minute Q&A session. So come along, learn something about Team Build, and then ask all of your questions. These sessions are from 4 pm – 5 pm (GMT-6)/7 am – 8 am (GMT+10) and the first is tomorrow.

TeamSystemLive.com Chat: WiX and Team Build Together at Last

TeamSystemLive.com Chat: Running Interactive Build Agents for UI Testing and Debugging

TeamSystemLive.com Chat: Build Reusable Build Definitions

TeamSystemLive.com Chat: Introduction to Team Build 2010





Team System 2010 Feature Overview

9 04 2009

Brian Harry has posted a 10,000 foot view of the features that will be included in Team System 2010.

He will be drilling into these features in more detail in future blog posts but if you haven’t been keeping a handle on what’s going to be in Team System 2010 this is a great place to start.





Drilling Into Build Performance

19 03 2009

 

In my last post on Monitoring Build Performance I showed a report that you can use to identify when your builds aren’t performing as expected. So how do you drill into a particular build to find out where the most time was spent?

One way to do this is to run your build with diagnostic logging by passing /v:diag when you queue the build. This will increase MSBuild’s logging verbosity to diagnostic and at this level of logging when the build completes a list of each target executed and how long it was executed for will be added to the build log. For example:

      144 ms  CoreTest                                   1 calls
      467 ms  CoreDropBuild                              1 calls
      471 ms  CoreGetChangesetsAndUpdateWorkItems        1 calls
      529 ms  InitializeEndToEndIteration                1 calls
     1031 ms  CoreSimian                                 1 calls
     1295 ms  CoreInitializeWorkspace                    1 calls
     1322 ms  CoreLabel                                  1 calls
     1367 ms  Build                                      3 calls
     1888 ms  CoreCompileSolution                        1 calls
     1986 ms  CoreCompileConfiguration                   1 calls
     2179 ms  CallCompile                                1 calls
     2799 ms  CoreCompile                                3 calls
     9744 ms  CoreGet                                    1 calls

This assumes that you know before the build is executed that you want to investigate its performance, what if you want to investigate the performance of an already completed build? Or what if your log files are an unmanageable size with diagnostic logging enabled. In these circumstances we can query how long each step takes from the Team Build operational database (TfsBuild).

Caveat: The operational databases are undocumented, unsupported, you should never insert, update, or delete rows, and you should be careful querying them to minimise performance impact caused by read locks.

Still reading? Of course you are. The query below returns a list of the build steps for a particular build in descending order by duration. You’ll need to set the DefinitionName and BuildNumber to the relevant values for the build you want to query, but watch out, the values in these columns do not match exactly what you see in the user interface. The values in the database have a trailing backslash and replace some characters (for example, underscore) with a right angle bracket. You should query the build definition and build tables to check the exact values to query for.

SELECT Name,
       Message,
       CONVERT(datetime, LEFT(StartTime,23) + 'Z', 127) AS StartTime,
       CONVERT(datetime, LEFT(FinishTime,23) + 'Z', 127) AS FinishTime,
       Status,
       DATEDIFF(s,
           CONVERT(datetime, LEFT(StartTime,23) + 'Z', 127),
           CONVERT(datetime, LEFT(FinishTime,23) + 'Z', 127)
       )/60.0 AS Duration
  FROM (
           SELECT BI.NodeId,
                  BIF.FieldName,
                  BIF.FieldValue
             FROM tbl_BuildDefinition BD
                  INNER JOIN tbl_Build B ON BD.DefinitionId = B.DefinitionId
                  INNER JOIN tbl_BuildInformation BI ON B.BuildId = BI.BuildId
                  INNER JOIN tbl_BuildInformationField BIF ON BI.NodeId = BIF.NodeId
                  INNER JOIN tbl_BuildInformationType IT ON BI.NodeType = IT.NodeType
            WHERE BD.DefinitionName = 'Main>Daily\'
                  AND B.BuildNumber = '699.0.1.793\'
                  AND IT.TypeName = 'BuildStep'
                  AND BI.ParentId IS NULL
        ) SourceTable
        PIVOT
        (
            MIN(FieldValue) FOR FieldName IN ( FinishTime, Message, Name, StartTime, Status )
        ) PivotTable
ORDER BY Duration DESC

For example:

image





Monitoring Build Performance

19 03 2009

Developers love nothing more than complaining about how long their builds take, sometimes their complaints are justified and sometimes they’re not. Even worse sometimes performance degrades slowly over time and no one notices.

To better quantify how long builds are taking I created a Build Performance report that is emailed to me monthly. This report gives the minimum, maximum, and average build duration (in minutes) for each of our main build definitions over the last 12 months.

Below is an example of that report and you can download the Build Performance Report Definition for SQL Server 2005 Reporting Services from here. If you want to restrict the build definitions that are included you can add an additional condition to the WHERE clause:

AND (
    [Build].[Build Type] LIKE ‘DEV_._’
    OR [Build].[Build Type] = ‘Main’
)

image-thumb

This report was made better thanks to SSW’s Rules to Better MS SQL Reporting Services.





Error creating an instance of COM object when opening Team Explorer

17 03 2009

One of our users has been getting the error “Creating an instance of the COM component with CLSID {B69003B3-C55E-4b48-836C-BC5946FC3B28} from the IClassFactory failed due to the following error: 8007000e” whenever they open Team Explorer.

Searching the registry for this CLSID (on a different machine) identified that it was the Messenger UI Automation component used by the latest Power Tools. Because we’re not yet using the Messenger integration the solution was to simply change the Collaboration Provider to <None>. This can be done by right-clicking the Team Members node in Team Explorer, clicking Personal Settings, and clicking Change.





New Team System Home on MSDN

9 02 2009

Team System now has a new home on MSDN which is cleaner, easier to navigate, and has been cleaned up to remove redundant and inaccurate information. Let the team know what you think by leaving feedback.