Implement CI (Continuous Integration) – Create Build Agent to trigger build for .NET Core App

Implement CI (Continuous Integration) – Create Build Agent to trigger build for .NET Core App

Implement CI (Continuous Integration) – Create Build Agent to trigger build for .NET Core App

As we all know that CI is one of the process of Agile methodology to develop software faster by using smaller iteration sprint. The project that we develop with .NET Core to utilise the built-in DI and cross-platform support. Our source code hosted on TFS on-premise, so we need to create build agent with .NET Core support

Create Build Agent

To build or deploy your code, you need to have at least 1 build agent. If you already had build agent or using Microsoft-hosted agent from Visual Studio Team Services, you can skip this step. This step will show you how to create self-hosted build agent. You can view the agent pool to see if you already had build agent. The below screenshot shows that I already had a build agent

Let’s get started to create your first self-hosted build agent

Step 1. Login to your tfs server then create Personal Access Token by clicking to your profile and Click Security -> Add Personal Access Token and select scope as Agent Pool (manage, read). Keep the token in a safe place, you will need to use it later to create a new build agent. Then choose Download Agent. **You need to download agent to your TFS Server and follow instructions.

Step 2:

Open PowerShell and create agent folder
mkdir agent ; cd agent

Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory("$HOME\Downloads\", "$PWD")

PS C:\agent> .\config.cmd

Step 3: 

Follow instructions to setup TFS Url – ** TFS Url needs to be a secured connection HTTPS to use PAT security method. When it prompts Access Token, use the Personal Access Token from Step 1. Once it all succeeds, new build agent will appear on Agent Pool

Posted by justinpham, 0 comments
.NET Core – Unable to bind to http://localhost:xxxx on IPv4 loopback interface. Error – 4092 EACCES permission

.NET Core – Unable to bind to http://localhost:xxxx on IPv4 loopback interface. Error – 4092 EACCES permission

Error – 4092 is a very usual error when you run the .NET core application by using dotnet cli. It means the port has been taken by another app.

You can change port number in the <php>launchSettings.json</php> file to quickly solve the problem. However, if your application use that port on different components, you should kill the running port by using netstat

Run command-line as an Administrator. Then run the below command

netstat -ano | findstr :portnumber

Then you can use taskkill to kill the port with PID

taskkill /PID PIDNumberHere /F
Posted by justinpham, 0 comments