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.
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.
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.
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.
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.
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.
Team Foundation Server makes it easy to manage and track work on any type of project, and this is just a small sampling of the capabilities of TFS. Visual Studio Online makes getting started with TFS easy, and for small teams it is free. To learn more about TFS you may be interested in the following Learning Tree courses