We set up a repeatable CI build for our new .NET Core project so we can pretend we’re professionals. We’re old and crotchety though so we still use TeamCity instead of something hip. 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.
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:
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:
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 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!