The Ramblings of Two Microsoft .NET Developers, TFS, and Visual Studio ALM Guys --- "Yes, we are both named Ed."

Need a List of Strings as a TFS 2010 Build Process Parameter?



I’ve been hitting my head against the table today trying to have a nice experience for editing a collection of string values as a custom build process parameter in my TFS 2010 build definition.  The problem comes with what editor is actually used to edit the process parameter at design time.  You can specify a custom editor for any of your custom build process parameters which is really handy but I needed the ability to use editors that were out of the box but still provided a sufficient experience to the end user.

My journey towards a solution…

Attempt 1

I began really wanting to have one build process parameter that had the type of Dictionary<string, string>.  That didn’t work out so well because when I went to edit it in my build definition, I received this editor and the add/remove members buttons.

TFS 2010 Build String Collection Editor

Attempt 2

I gave up on the Dictionary<T, T> approach and decided that I could handle it by specifying two collections of type Collection<string>.  I also attempted to try List<string> and even a String[] but ended up with this editor that seemed to not like System.String.

TFS 2010 Build String Collection Editor

Attempt 3

I found Microsoft.TeamFoundation.Build.Workflow.Activities.StringList.  It is a custom type that is known to Team Build 2010 and even has a custom editor that is registered to it that shows up.  That editor is Microsoft.TeamFoundation.Build.Controls.WpfStringListEditor.  Works great for me!  Take a look:

TFS 2010 Build String List Editor

 

Ed Blankenship



Tuesday, April 12, 2011 8:40:20 AM (Pacific Daylight Time, UTC-07:00)
When I use a default value in the build template (new StringList From {"value1","value2"}) it doesn't show up when I try to edit the build definition or queue a new build?
Tuesday, April 12, 2011 8:50:54 AM (Pacific Daylight Time, UTC-07:00)
Hi Brandon,

I haven't run into that particular problem but haven't attempted to explicitly set a default for a StringList just yet. Try posting the question in the TFS Build forum: TFS Build Automation Forum

If you are an MSDN Subscriber then you get priority support using the MSDN Forums.
Monday, November 05, 2012 11:19:33 AM (Pacific Standard Time, UTC-08:00)
Hi Brandon, I faced the same issue and struggled for a while and found the solution. In case you're still looking for it the way to make it work is by using the full qualified name when assigning the default value, something like this
New Microsoft.TeamFoundation.Build.Workflow.Activities.StringList({"UnitTests", "IntegrationTests"})
Some further details are in the MSDN forum post.
Hope this is useful to you. Kind regards,

Diego
Diego Malanij
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, sup, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview