Posts Tagged 'Continuous Integration'

Setting Up a Continuous Integration Server with Team Foundation Server (TFS)

What is Continuous Integration?

The goal of continuous integration is to allow developers to check in their code, compile it, run the tests, and deploy the application all in a single step. To accomplish this goal a number of things must be setup.

First, a version control system. Programmers check their work into the source control. Changes from each developer are merged to ensure there is a single master version of the program.

Second, the team needs automated testing. This is done using a unit testing framework. There are many such frameworks for every modern development language.

Third, there must be a test environment that the application will be deployed onto. Much of today’s software is written using Web technologies. Thus, the team will need a Web server they can deploy to for testing their application.

Fourth, a build server must be set up. The build server detects when code is checked in, compiles it, and then runs the tests. If all the tests succeed, the build server will deploy the application.

Sounds like a lot of hard work? Microsoft Team Foundation server makes it easy.

Team Foundation Server Version Control

TFS has two versions control systems. One is called Team Foundation Version Control and is a Microsoft product. The other is Git, an open source version control system. When a project is created with TFS one of these version control systems is selected. Both integrate with Visual Studio, and programmers can easily check in their code changes whenever they choose to.

Automating Builds with Team Foundation Server

Team Foundation Server includes a build service. To tell the build service what to do, you create a build definition. This is done from Visual Studio Team Explorer. Click on the Builds button and the select New Build Definition.

Team Explorer

When defining a build you need to specify a trigger that determines when the build runs. Select Continuous Integration and the build will run every time a programmer checks in his code.

Build Configuration

Visual Studio will automatically detect your unit tests and include them when running the build. That’s easy. The trick is to automate the deployment of the application. The easiest way I’ve found to do this is by specifying a Publishing Profile when defining up the build. This is done on the Process tab of the Build Configuration dialog. See the screen shot below. Notice, the command tells the build service to deploy when it runs and use a publishing profile called “LocalDeploy” to determine where to deploy the application.

Automating Deployment

 

 

Defining a Publishing Profile

Publishing profiles are created as a part of a Web project in Visual Studio. They specify where the Web application will be deployed. In the screenshot below, the publishing profile specifies that the application should be deployed to a virtual directory on the local machine. This could be any machine though, and any number of publishing profiles can be created in a Web project.

Publishing Profiles

 

Team Foundation Server Training

As you can see, setting up a continuous integration server using Team Foundation Server is easy and flexible. To learn more about TFS you may be interested in Learning Tree course 1816, Agile Software Development with Team Foundation Server.

 

Doug Rehnstrom


Learning Tree International

.NET & Visual Studio Courses

Learning Tree offers over 210 IT training and Management courses, including a full curriculum of .NET training courses.

Free White Papers

Questions on current IT or Management topics? Access our Complete Online Resource Library of over 65 White Papers, Articles and Podcasts

Enter your email address to subscribe to this blog and receive notifications of new posts by e-mail.

Join 29 other followers

Follow Learning Tree on Twitter

Archives

Do you need a customized .NET training solution delivered at your facility?

Last year Learning Tree held nearly 2,500 on-site training events worldwide. To find out more about hosting one at your location, click here for a free consultation.
Live, online training

%d bloggers like this: