C# NetCore

How to deploy C# based .NetCore project?


If you do not have code ready, you can fork the repository being used in this example: https://github.com/paladium/nativeci-demos

NetCore

We are going to deploy a simple hello world dotnet api, that will have a single endpoint:

/api/values

Guide

Choose your repo first:

Choose repo

Next, select DotnetCore deployment: Dotnet select

To choose a correct Dotnet version, open up the project and find your .csproj file:

<PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

Choose the version TargetFramework, e.g 2.1 or 6.0.

On the final screen, enter the following settings: DotnetCore settings

Build command:

#Default build command, will create out folder
dotnet publish -c Release -o out

#Run tests first
dotnet test && dotnet publish -c Release -o out

Folder:

#For monorepo example
dotnet-helloworld

Port to expose:

#Choose port 80 (default) as ssl is provided automatically

Deploy folder:

#Build command deploys into out
out

Run command:

#Take project name
dotnet dotnet-helloworld.dll

After that you can visit your api and see how easy it was to deploy it: Deployed

Note: if you need to configure which settings file to use, set environment variable ASPNETCORE_ENVIRONMENT to Production - Set runtime environment variables

Edit this page on GitHub Updated at Wed, May 17, 2023