Click here to Skip to main content
15,884,836 members
Articles / DevOps

Guide to Build/Deploy by TFS

Rate me:
Please Sign up or sign in to vote.
1.33/5 (2 votes)
12 Feb 2018CPOL3 min read 14.2K   10  
Description to use TFS source code repository to build and deploy server

Introduction

In this article, I will talk about how to use TFS server to Build and Deploy, with an TFS Agent.

TFS can do the same thing as TeamCity and Octopus. TeamCity is missing the Deploy part. That's why TeamCity users also have to install Octopus to the Deploy part. TFS Agent is installed on the CI Server.

Image 1

Guide to Setup Build Agent

This explains how to use TFS to create an automatic build and deployment, of .NET code.

The first step is to make an Agent on a Build server.

Connect to the TFS website. Select the Build and Release Tab. Then select Agent Queues.

Image 2

Push “Download agent” button and description of how to install the Agent on the server shows up.

Image 3

Downloaded the Zip file “Agent”, and then you have to set it up on Build server (CI Server).

Image 4

Run Config.cmd:

Image 5

The URLs are there the Source Code (TFS Server).

https://name.visualstudio.com - TFS

Then it asks for Authentication type: Negotiate - Integrated - PAT

And here we choose, PAT

To create Personale access token” go to Profile.

Image 6

Select Security.

Image 7

Select “Personale access token” and push Add token.

Please note that it can work for a maximum of one year.

Insert Token under “PAT – Personal access token”, in Command Prompt.

Image 8

Select New, and pick between various names to the Pool.

And Agent name.

Config.cmd is finished.

Image 9

And you can see it in TFS.

Image 10

Services:

Image 11

By setting in for Config.cmd, the services have been added to the Build server, and it will appear under “services”.

Image 12

Services name is vstsagent.”Urlname”.Build_Server.

Agent Setup is finished.

You’re now able to build and deploy your source code.

Guide to Setup Build/Deploy

Go to Build and Release tab.

Image 13

Select “New”, and select different template is possible.

Select a .NET Desktop. Simple project.

Image 14

I select .NET Desktop.

Image 15

Select the Agent to run the Build. (Red box).

Then select the Project in TFS store, you would like to run. Select the Solution file in your source code.

Image 16

Save” for saving.

Save and queue”, for saving and if you run a build of source code.

Image 17

Then it will have success build and deploy.

Build History

Click on the Build number, it shows historic and Test OK, Code coverage, etc..

Under “Associated changes”, the “Check in” is showing what the build has in the changes.

Image 18

Select 591 change, and see the changes in code. List of files, and select one file, to see the changes.

Image 19

Build Test History

Only tests with identical name tag same as Build Definition, will be run under build.

See it in VsTest.

Image 20

In the code base: write "TestCategory" after TestMethod.

C++
//
[TestMetode, TestCategory(DynDB.NETDesktop-CI)]
public void ToStringTest()
{
    const string key = "123456";
    CompositeId composite = new TestId(key);

    Assert.AreEqual(composite.ToString(), composite.Key);
}
//

Build Deploy Path

Under Publish Artifact: drop shows the release package is dropped.

Image 21

Build Trigger

Can set a Triggers Up. “Continuous integration” When It make a Build/Unit Test/Deploy after every Check in.

Image 22

Points of Interest

It is a very nice tool to DevOps where they can follow the entire process from task to code change to Deploy.

Hope you enjoy the setup of TFS Build.

To read more about it, read https://docs.microsoft.com/en-us/vsts/build-release/test/example-continuous-testing.

History

  • 8th February, 2018: Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Similix ApS
Denmark Denmark
I have working with C since 1988, and updates to VC++ in 1998. The first software I was making in VC++ was Fan calculation program with graph. This Fan Was integrated with the Oracle system.
I've been working almost exclusively with C# and .NET since
beginning of the technology.
Now I am working with Web API and CRM, MVC 6.0, SQL Server, C# and .NET. The Similix ApS is a IT konsult house and working with GIS (Esri).
In my work, I have gained extensive experience with web security. ADFS etc..
Have also gained experience with DevOps CI and automatic deployment

Comments and Discussions

 
-- There are no messages in this forum --