From 5f86f500c6d6432ccde95a07a491b0820703af65 Mon Sep 17 00:00:00 2001 From: Musa Misto <64855513+MusaMisto@users.noreply.github.com> Date: Mon, 31 Aug 2026 14:25:52 +0300 Subject: [PATCH] fix(build): target .NET 8 in the Docker build to match the projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Docker build has failed on every run since the projects moved to net8.0 (d48988f, 2026-02-12). The Dockerfile still pinned the .NET 6 base images it was given in 2024-03-31, so the SDK 6 image could not build a net8.0 project: error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. [/src/SW.Mtm.Web/SW.Mtm.Web.csproj] That is why no chart or image has been published since 6.0.9 (Feb 2026) — `ci` fails, so `deploy` and `tag` never run. Reproduced locally byte-for-byte against the CI log before changing anything. - Dockerfile: aspnet 6.0 -> 8.0, sdk 6.0 -> 8.0 (match TargetFramework). - Dockerfile: copy SW.Mtm.MsSql.csproj into the pre-restore layer. It is a ProjectReference of SW.Mtm.Web but was never copied, so restore logged "Skipping project ... because it was not found" and the layer resolved an incomplete graph. Now 0 skip warnings. - ci-cd.yml: dotnet-version 6.0.x -> 8.0.x. Currently masked — there is no global.json, so the runner's newest preinstalled SDK is selected and the nuget job passes anyway — but the pin contradicts the projects and would break the moment a global.json is added. NOT bumping to 9.0 (Dependabot #117/#118). Verified empirically: sdk:9.0 + aspnet:9.0 BUILDS successfully and then fails at startup with "You must install or update .NET to run this application. Framework: 'Microsoft.NETCore.App', version '8.0.0'" — .NET roll-forward does not cross major versions by default. Those PRs would ship a green build and a crash-looping image. They should be closed, or the projects retargeted to net9.0 first. Verified: build fails before / succeeds after; the resulting image starts under the .NET 8 runtime and reaches application code (it then fails only on database connectivity, with no database configured locally). Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01VHkpqv6dB6wjALyFe9ocMU --- .github/workflows/ci-cd.yml | 2 +- Dockerfile | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index b35db4f..5219b29 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -21,7 +21,7 @@ jobs: with: major-version: '6' minor-version: '0' - dotnet-version: '6.0.x' + dotnet-version: '8.0.x' # Build + test + push the SDK NuGet package nuget-projects: 'SW.Mtm.Sdk/SW.Mtm.Sdk.csproj' diff --git a/Dockerfile b/Dockerfile index 0608759..53bd3bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,15 @@ -FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src COPY ["SW.Mtm.Web/SW.Mtm.Web.csproj", "SW.Mtm.Web/"] COPY ["SW.Mtm.Api/SW.Mtm.Api.csproj", "SW.Mtm.Api/"] COPY ["SW.Mtm.Sdk/SW.Mtm.Sdk.csproj", "SW.Mtm.Sdk/"] +COPY ["SW.Mtm.MsSql/SW.Mtm.MsSql.csproj", "SW.Mtm.MsSql/"] COPY ["SW.Mtm.MySql/SW.Mtm.MySql.csproj", "SW.Mtm.MySql/"] COPY ["SW.Mtm.PgSql/SW.Mtm.PgSql.csproj", "SW.Mtm.PgSql/"]