Home > Team Build, TFS, TFS2010 > TFS2010 Add New Argument/Parameter to a Build Template

TFS2010 Add New Argument/Parameter to a Build Template


This post was created in response to this forum question on msdn:

http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/91619304-93df-4635-ba89-7c16f477b852

It is fairly simple to add a new argument to your build template

Click on the Arguments tab

Scroll all the way down and click “Create Argument”

Type the name of your argument (e.g. BuildEnvironment)

To make the argument required, to customize its category, or use a customized editor, we need to create a new parameter in Metadata property as shown in the following image

In the team definition, I added Switch activity (can be added where you want to use that argument) and changed the expression to BuildEnvironment.ToLower to make it case insensitive. Switch activity can be replaced with If activity if the argument can be set to only two values

Click on “Add new case”, type case value to be “dev” or whatever value you need.

Repeat the above steps for other environments (i.e. QA, Prod,..etc)

Click “Add an activity” next to the case statement (e.g. dev)

Drop an activity where it says “Drop activity here”, you can use an Assign activity from the primitive group to initialize certain path

When done, check in the template

Create a new build definition

Under the Process tab, choose your customized template

Notice that you can see your new argument as a parameter

Advertisements
Categories: Team Build, TFS, TFS2010 Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: