Thursday, December 22nd, 2011

Before starting with how to achieve continuous integration with TFS, lets try and understand why it is required?

Wiki says:

In software engineering, continuous integration (CI) implements continuous processes of applying quality control — small pieces of effort, applied frequently. Continuous integration aims to improve the quality of software, and to reduce the time taken to deliver it, by replacing the traditional practice of applying quality control after completing all development.

Which is very true!

And the principles of continuous integration are :

  1. Maintain a code repository
  2. Automate the build
  3. Make the build self-testing
  4. Everyone commits to the baseline every day
  5. Every commit (to baseline) should be built
  6. Keep the build fast
  7. Test in a clone of the production environment
  8. Make it easy to get the latest deliverables
  9. Everyone can see the results of the latest build
  10. Automate deployment

If you can think for a while how every stuff adds value and helps in getting the quality product out at a higher rate by reducing risk you have already 50% through with the process. Rest all is matter of utilizing the feature provided by the CI tools/infrastructure.

Lemme start with maintaining code repository. If you follow few guidelines, it makes the life much easier to maintain the code. It all depends on nature of the application & process you follow.

Define your environments:

Defining branching is major decision to be taken and it all depends on the scenario or the process you are in. Go throw this site before strategizing the branching

For instance, lets consider a simple branching strategy around environments (dev,qa & prod) with single release.

Define environment dependant configuration:

First and foremost, define the configurations for each environment. Configurations as such, DB to point, service url to refer, user accouts to be used etc. This can be achived by having a configuration file each environment.

1.       Select the solution

2.       Right cick -> configuration manager

3.       Define the configuration for all environments (and debug/release modes for local settings & dev workarounds) -> Using Configuration Manager

4.       Make use of the interesting feature Add Config Transforms offerred by VS2010/.net4.0 web application project template to maintain web.config for each configurations.

5.       Strangly we don’t have this luxury for other application templates. Thr is a combursome procedure of modifying your cs proj file to achive this feature (refer:

I prefer to write a small batch scripts which overrides the app.config  befroe the build. Call the batch script on pre-build event of the project.

Define TFS build for each environment:

TFS2010 has very strong and extensible support for build J. Its easy and scallable. You can get a smiple build procedure up, by following the new build wizard

1.       Go to team explorer in VS 2010 ->  Builds -> New Build Definition

2.       Define the build for dev environment.

a.       Name

b.      What triggers the build. Notice the interesting scheduling options J

c.       For which solution?

Path of the soultion to build. You can have multiple solutions build on same time. Have an eye on Build Agent Folder path.

d.      Need to drop the output of the build to a location? Oh yeah, you can do it in build defaults.

e.      Here comes the most important step of build definition, the Process.

f.        Quick tips:

i.      As I stated earlier, we will be having a different builds for each environment. Now it’s the time for chosingthe configuuration we defined. Provide appropriate configuration name for the property Configuration to  Build.

ii.      Want to run the unit testcases? Provide the assemblies for the propert “Test Assembly Filesspec”.

iii.      Want to fail the entire build on test fail even if the compliation was successful ? set “Fail Build On Test Failure” to true

iv.      Want to run the code coverage? Enable code coverage (refer): and provide the local.testsettigns file to “TestSettingsFile”.

v.      Want to run the Code Analysis on the build? Set the “Perform Code Analysis” option. Make sure, you have selected appropriate rulesets in the project (refer:

vi.      Want to deploy the application? (Only Web Apps) Provide publish parameters to “MSBuild Arguments





/p:DeployIisAppPath=”Default Web Site/WebApplication1″



vii.      How to deploy web or any other applications? This is a generic process, invbolves writign some batch scripts J

Ref :

g.       You define the rention policy too.

This ends defining the build for a specific environment. Repeate the above steps for other 2 environments/branches with environment specific details such as ,

1.       Solution location

2.       Scheduling

3.       Drop location

4.       Configuration to run

5.       Enablingor disabling of Automatic deployment, Runnign unit test, code coverage or any other details.

Once we have have all the 3 build definitions defined, we can view, enquue,delete or modify the build.

Click onView Builds to see all possible builds

Click Open to explore  different features provided and majorly to see what happened with the build.

Opt for alerts to be on track with build status by selecting Project alert option under “Team” menu in toolbar.

Category: .Net, Agile/Scrum, General
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

4 Responses

  1. Definitely believe that which you said. Your favorite reason appeared to be on the internet the simplest thing to be aware of. I say to you, I definitely get irked while people consider worries that they just don’t know about. You managed to hit the nail upon the top and also defined out the whole thing without having side-effects , people can take a signal. Will likely be back to get more. Thanks

  2. 2
    lip balms 

    There’s certainly a lot to find out about this issue. I really like all of the points you made.

  3. mais had site li ktebti !? rah dyal pes2011 ! Ou li f vidéo dyal Pes06 ?

  4. Normally I do not learn article on blogs, however I wish to say that this write-up very forced me to try and do so! Your writing taste has been amazed me. Thanks, quite great post.

Leave a Reply


This blog is kept spam free by WP-SpamFree.