CI - Creating a Project in TeamCity


Advertisements

Now that we have our source code in the Git repository and all of our initial code works on the build server, it is time to create a project in our Continuous Integration server. This can be done via the following steps −

Step 1 − Login to the TeamCity software. Go to the url on your Continuous Integration server − http://localhost:8080/login.html.

TeamCity Software

Enter the admin credentials and login to the server.

Step 2 − Once logged in, you will be presented with the home screen. Click Create Project to start a new project.

Create Project

Step 3 − Give a name for the project and click Create to start the project. In our case, we are giving the name as ‘Demo’ to our project as shown in the following screenshot.

Project Name Demo

Step 4 − The next step is to mention the Git repository which will be used in our project. Remember that in a Continuous Integration environment, the CI server needs to pick up the code from the Git enabled repository. We have already enabled our project folder to be a Git enabled repository in the earlier step. In TeamCity, you need to create a VCS root. For this, click VCS Roots in the project’s main screen.

VCS Root

Step 5 − In the screen that comes up next, click Create VCS root as shown in the following screenshot.

Create VCS Root

Step 6 − In the next screen that comes up, perform the following steps −

  • Mention the type of VCS as Git.

  • Give a name for the VCS root, this can be any friendly name. We have given the name as App.

  • Give the Fetch url as C:\Demo\Simple – This is out git enabled repository.

  • If you scroll down the screen, you will get a Test connection button. Click it to ensure that you can successfully connect to the Git enabled repository.

Test Connection Button

Test Connection Button Appears

Step 7 − Click Create and you will now see your repository registered as shown in the following image.

Repository Registered

Step 8 − The next step is to create a build configuration which will be used to build the project. Go to your project screen in TeamCity → General Settings. Click Create Build Configuration.

Team City General settings

Step 9 − In the following screen, give a name for the Build Configuration. In our case we have named it as DemoBuild and then click Create.

Demo Build

Step 10 − In the next screen that comes up, you will be asked to choose the VCS repository which was created in the earlier steps. So choose the name ‘App’ and click Attach.

VCS Repository

Step 11 − Now in the next screen that pops up, we need to configure the build steps. So click the ‘configure build steps manually’ hyperlink.

Configure Build Steps Manually

Step 12 − In the next build screen, we need to enter the following details −

  • Choose the Runner type as MSBuild.

  • Give an optional name for the step name.

  • Give the name of the file which needs to be built. When we specify MSbuild in the earlier sections, we normally see that we give the option of Simple.csproj. The same thing is needed to be specified here.

  • Choose the MSBuild version as ‘Microsoft Build Tools 2013’.

  • Choose the MSBuild ToolsVersion as 12.0.

  • Scroll down the page to Save the settings.

MS Build Tool Version

MS Build Tool Version 12.0

Step 13 − In the next screen, click Run.

Click Run

You will see the build of your application now in progress.

Application in Progress

You should get a successful screen, which is a good sign that your solution is building properly.

Successful Screen

You can also go to your build log to see all the steps that were covered by the Continuous Integration server as shown in the following screenshot.

Continuous Integration Server
Advertisements