Build a .NET Core C# application on a Linux computer

GitHub Actions usually run on Linux workers. GitHub provides worker configuration recommendations, and those are usually Linux based.

To build our .NET Core C# application on a Linux machine

Install the dotnet-sdk

On MacOS

brew update
brew install dotnet-sdk

On Ubuntu

apt-get install dotnet-sdk

On Red Hat

yum install dotnet-sdk

Build the application

Open a terminal in the project’s directory

Restore the NuGet packages

dotnet restore

Build the project

Specify the –runtime to make sure the necessary libraries are included

dotnet build --runtime win-x64 --configuration Release MY_DOTNET_CORE_PROJECT.csproj

Leave a comment

Your email address will not be published. Required fields are marked *