TFS 2010 – Ordering the Build Process Parameters On The Definition

So, I had someone ask this question about the process parameters on the Process tab of the Build Definition Editor – “How can I get the Advanced category above the Basic category?” I decided it would be better to share this with everyone, since it isn’t documented anywhere.

The first thing to note is that a property grid does not allow custom sorting of categories. They are always in alphanumeric order. However, we get around this by numbering the categories. This allows us to sort them, but we don’t sort them by name. We sort them by priority. What priority? Let me show you what I mean.

If you open the defaultTemplate.XAML file in the editor and click on the Arguments button to show the top level parameters, you will see a property called “Metadata”. This property can be used to override the meta data that we have on the process parameters. You would also want to use this property to set the meta data for any custom process parameters – see this post for more info.

Under the “Default value” column click the “…” button to edit the Metadata. Unfortunately, we don’t populate this with the default values. You have to know them (luckily I can simply look back at the source code :).

Here is what you see…


Notice the category field. If you add a new parameter (with the same name as an existing parameter) you can set the metadata properties. I chose to modify the Agent Settings process parameter. I set all the metadata to exactly what we set it to in code, so there shouldn’t be any differences when I run it.

Here’s what that looks like…


When I check it in and open the definition, the process parameters are all exactly the same as before. So, where is this “category priority”. Well, I actually lied before. The category in the picture above is NOT the category string that we use. The category string we use is actually “#300 Advanced” The ‘#’ at the front tells the code that the first part of the string is a priority number. Notice that we use 300 here. Required is 100, Basic is 200, and Advanced is 300. That allows space for you to put your own categories before or in between ours.

So, what do you think happens if I change the Category to “#150 Advanced”?

After saving and checking the change in, I get the following order when I look at the process parameters:


Since I changed the priority for the Advanced category on Agent Settings, that value was used instead of the default value of 300. Thus, the entire category was moved above the Basic category.

Now, we automatically collapse any section named “Advanced” so this won’t fix that problem, but it does show you that you can move the categories around and put your own categories before ours.

Happy coding!

Comments (17)

  1. Daniel Morritt says:

    Almost a year on and this was exactly what I needed, thanks 🙂

  2. Great88 says:

    How Can we do this using API's

  3. You don't need any APIs. All I am doing above is updating the text in the XAML. It's just text, so you could simply update the XAML directly or with some custom tool. Follow the steps above and look at the diff of the XAML file after the changes.

  4. Wiles13 says:

    It does not work correct if you have more then 9 categories, e.g. 11 categories:

    1. Required

    10. Some category

    11. Another category

    2. Basic

    3. Advanced

  5. That is exactly right. The ordering is AlphaNumeric. So, 10 comes before 2. You can fix this by specifying 2 digits in all the categories. But, I would argue that 10 categories is way too many. One of the reasons that we have 3 built-in categories is that we felt 3 was enough.

  6. Wiles13 says:

    Where can I specify the 2 digit numbering?

  7. Jasper says:

    Hi Jason,

    Can you indicate the procedure for the 2 digits numbering? unfortunatly i have more than 10, agreed that it is allot, but fact. Any clarification is highly appreciated!


  8. Hi Jasper and Wiles,

    I was wrong. There is not a way to specify 2 digits in the number format. Sorry for the bad information. I will try to fix this bug in our code so that it prefixes the Categories with zeros if needed.

    Thanks for letting me know about the problem.


  9. Anthony Estelita says:

    Do you happen to know if there is a way to initially collapse a category?  We have some optional build arguments that I'd like to show collapsed/hidden and was curious if this is possible (similar to how the Advanced section is initially collapsed). 🙂

    Thanks in advance for any suggestions,


  10. Unfortunately, we don't provide a way to do that. Unless, of course, it is named "Advanced". We look for that name and collapse that section.


  11. James says:

    Is this Process Parameter Metadata Editor missing in VS 2012?

    >> "Under the “Default value” column click the “…” button"

    This "…" button does not exist.

    There is a "…" button in the properties window, but it just brings up the expression editor.

  12. Hi James,

    This isn't what you want to hear, but it works for me 🙁

    you can edit the Metadata directly in the XAML by opening it in Notepad or the VS xml editor. If you figure out why it isn't working, please let me know.



  13. The order number "#300" is not hidden for parameter display name says:

    The #300 pattern is handled (hidden) if that is in front of the parameter category, however is not hidden if want to order the individual parameters, for instance "#401 Package by Install Shield" is the parameter display name defined in the metadata list, and it is shown as "#401 Package by Install Shield" in the UI. the "#401" was not hidden.

  14. You are correct. We don't currently have a good way to order the items within the categories. You can put numbers beside them yourself, but I know that's not ideal.


  15. WebBuddha says:

    Echoing James above. I see the elipse button but the main process "categories" aren't there as they were in 2010. I see the parameters that I've setup, but not the main parameters and their display names. Using VS 2012 with Update 2 and the power tools. Any thoughts?

  16. Hi Joseph,

    I would compare your XAML file to the default XAML and see if anything jumps out. My only guess would be that somehow the type for Metadata was changed from Property to InArgument. But that's just a guess.

    Good luck,


  17. Taffarel says:

    I found this post I long time ago and used it successfully with TFS 2010 and 2012 – worked like a charm. But now I'm working with VS Online. When I attempt to add any custom property to my build template, no matter what I put for the category (I've tried #200 Basic, #300 Advanced, and custom categories), they always get lumped in "4. Misc" at the bottom. Is this feature disabled in the 2013 product family? Is it just not allowed in the hosted instances? Or am I missing something else?