The TFS Build Definition List<T> OOTB UITypeEditor
A while back I came a problem:
I needed to build for a client an activity that runs on an unknown number of projects and builds them with DevEnv 2005/2008/2010.
I needed to create an editor that allows the user to select projects to be built in DevEnv and additional properties for each project such as “DevEnv version” and “Configuration to build”.
The problem was that I had very little time to do this.
This is where my good friend Baruch Frei came into the picture; He informed me that when I build a simple dumb object such as:
1: using System.ComponentModel;
2:
3: namespace BuildDemosB
4: {
5: public class DevEnvCompilationItem
6: {
7: [Category("Properties")]
8: public string Project { get; set; }
9:
10: [DisplayName("Compiler Name")]
11: [Category("Properties")]
12: public DevEnvType CompilerName { get; set; }
13:
14: /// <summary>
15: /// Specifies whether Clean and then build the solution or project with the specified configuration. Default is false
16: /// </summary>
17: [Category("Properties")]
18: public bool Rebuild { get; set; }
19:
20: #region Methods
21:
22: public override string ToString()
23: {
24: return string.IsNullOrEmpty(Project) ? "New" : Project + "=>" + CompilerName;
25: }
26:
27: #endregion
28: }
29: }
and add a List<T> of that object to the builds “Process Template” as an argument like this:
What we will see in the “Process” tab of the “Edit Build Definition” window is the Microsoft “out of the box” editor of the List<T> object in TFS build definition.
This editor will hand us the functionality of adding and removing objects of type T to and from the list as well as to edit each of the public properties of the object.
On the left side you see the object in the list, displayed by their ToString() method, and on the right you see a properties grid of the selected object on the left.
What is also nice is that if you have in your object properties such as Boolean or Enum the properties grid will inflict those restrictions in the form of a drop down.
Easy and fast.
In my next post I will show how to use some of Microsoft's internal UITypeEditors with the OOTB List<T> editor.