Tuesday, May 10, 2011

Tfs2010 string collection build argument snags

So it's great that you can use custom types, or more advanced types in Tfs 2010 workflow builds than you could in MSBuild tasks. However the editor/designer support is severely lacking. If you want an editor or designer that everyone can open up and even see what's set there, a custom assembly or vsix package has to be run on every machine that would need to be able to see or edit that argument. Even for something as basic as List<string>

After weeks of posting, forums, research etc... And trying this post it turns out that the legacy string array is what functions.

I wanted to

  • Provide defaults in the template, so that the consumer could just leave it if they didn't want anything more specific.
  • Allow for full customizations, adding, editing, removing.
  • Visibility of what's set for anyone looking at the build definition, not just people with a special assembly loaded.
But if you have tried the others they may have saved to the tfs database and cause your attempts to edit or view them to fail as if the type you are now trying isn't working. Here's a list of things I tried:
  • Microsoft.TeamFoundation.Build.Workflow.Activities.StringList
  • System.Collections.Specialized.StringDictionary
    • creating my own custom editor and adding it to the metadata
  • System.Collections.Generic.IList<string>
  • System.Collections.Generic.List<string>
As it turned out, I have no idea how many of these may have worked had the edit attempts I made not saved into the tfs database. 

Once I finally changed the variable name and tried String[] Array. All of the sudden, everything worked just fine. Alternatively, clicking refresh in team explorer -> Edit Build Definition -> Process tab -> Show details arrow -> click refresh is supposed to work. I wound up renaming the variable. 
So I went back to try all the types I listed and a few more... and the first 3 worked:

  • Microsoft.TeamFoundation.Build.Workflow.Activities.StringList
    • No custom editor specified
    • Microsoft.TeamFoundation.Build.Controls.WpfStringListEditor
  • String[] Array
Entirely or partially failed to function:
  • System.Collections.Specialized.StringDictionary
  • IList<string>
  • List<string>
  • IDictionary<string>
  • Dictionary<string>
  • Microsoft.TeamFoundation.Client.KeyValueOfStringString
  • KeyValuePair<string,string>[]

 What I want is a dictionary<string,string> but I'm getting pretty sure there's no support for it outside of a custom package deployed to all machines that want to view the arguments or edit them.

No comments:

Post a Comment