Vidulividuli

C#/.NET

Comprehensive information about C#/.NET app configuration.

Common Settings

The section outlines common settings and behaviours for C#/.NET projects.

.NET Version

Currently, .NET 9.0 is used for all C#/.NET builds.

We are planning to introduce .NET version detection soon.

Build Process

C#/.NET builds on Viduli use separate build and run images.

  • Build stage: Uses mcr.microsoft.com/dotnet/sdk:9.0 for compilation
  • Runtime stage: Uses mcr.microsoft.com/dotnet/aspnet:9.0 (smaller footprint)

ASP.NET Core

ASP.NET Core builds on Viduli use separate build and run images.

  • Base distribution: Debian (via Microsoft .NET images)
  • .NET version: 9.0
  • Default image:
    • Build: mcr.microsoft.com/dotnet/sdk:9.0
    • Runtime: mcr.microsoft.com/dotnet/aspnet:9.0
  • Included packages:
    • Build: clang gcc libc6-dev build-essential ca-certificates procps git curl wget nano
    • Runtime: ca-certificates procps git curl wget nano
  • Default port: 5000

Build dependencies

Dependencies are restored using dotnet restore. You can customize this by setting the install command value in the resource build configuration.

Build command

By default, the build command is dotnet publish -c Release -o /app/publish. The output directory defaults to publish. You can customize both the build command and output directory in the resource build configuration.

Run command

The default uses an entrypoint script that starts the ASP.NET Core application. The entrypoint script handles application startup and configuration.

It can be overridden by providing the run command in the resource build configuration.

Environment

The following environment variables are set:

  • ASPNETCORE_URLS=http://+:5000 - Application URLs (port can be customized)
  • DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true - Globalization invariant mode

By default, PORT is set to 5000. If you set an expose port value in the resource build configuration, ASPNETCORE_URLS and PORT are set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.