Display custom build steps in VS Team Builds "progress tab"
Is there a way that we can displayour custom MSBuild tasks in the "Build Steps" section of Team Builds "progress tab" (the tab opened when running a build)?
When you start a build via the Team Builds in VS Team System the first
section is "Summary" next is "Build Steps" this section displays task such as:
Initializing build, Getting sources, Compiling sources, etc.. What we would like
to do is place our custom tasks to notify the developers what the other tasks
are being performed such as: Website being created, Site updates being applied,
etc.
We would like to accomplish this by editing the MSBuild project file only, although, we are open to otheroptions as well.
Thanks in advanced for in help with
this.
This cannot currently be done by simply editing the MSBuild project file, but should be simple enough within your custom tasks. You will need to use the AddBuildStep and UpdateBuildStep web methods, exposed through the BuildStore web service.
Add a TeamFoundationServerUrl property and a BuildUri property to your custom tasks, and set them, within the MSBuild project file, to $(TeamFoundationServerUrl) and $(BuildURI), respectively. Then you should be able to do something like the following:
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Build.Proxy;
TeamFoundationServer m_tfs = TeamFoundationServerFactory.GetServer(TeamFoundationServerUrl);
BuildStore m_buildStore = (BuildStore) m_tfs.GetService(typeof(BuildStore));
m_buildStore.AddBuildStep(BuildUri, <buildStepName>, <buildStepMessage>);
m_buildStore.UpdateBuildStep(BuildUri, <buildStepName>, <completionTime>, <completionStatus>);
The idea would be to add the build step at the beginning of your tasks execution, and then to update it with a time and status code at the end of execution. Note that <buildStepMessage> will be the string displayed in the GUI, while <buildStepName> is just an identifier for your build step.
-Aaron