The unexciting ground work for RequestMetrics continues. We’ve got a basic ASP.NET Core project up and committed to Github. Now we need to build it! We have used TeamCity to build TrackJS for years. Since we don’t like change, we’re using it for Request Metrics too.

Publish Profile

We use a publish profile to build the linux binary executables which will run in production. We just want build artifacts and don’t actually want to deploy anywhere yet. From within Visual Studio, we create a File System publish profile with these settings:

Visual Studio 2019 File System Publish Profile For Linux Executables

Using a Publish Profile From the CLI

A publish profile can be executed from the dotnet CLI as well as from within Visual Studio. This awkward command publishes a release version of the a profile:

> dotnet publish -c Release /p:PublishProfile=MyProfileName

TeamCity Configuration

Our TeamCity build uses the dotnet CLI as well. We want to build these linux binaries and store them as artifacts within TeamCity for later use. The dotnet command above can be translated into the TeamCity build configuration. Note: We explicitly set the publish output directory because TeamCity ignores the path specified inside the publish profile! Our Deploy build step now looks like this:

TeamCity dotnet CLI Publish Build Step Configuration

TeamCity might not be flashy, but it gets the job done. We now have a job that automatically builds production-ready binaries every time we commit new code to our repository!