Anyone have any idea why despite successfully installing the latest .NET SDK (10.0.100) directly from Microsoft’s recommended dotnet-install.sh, the build script is trying to use 8.0 instead? I am using the latest Ubuntu image and this same process worked fine with .NET 6.0 - 9.0.
[netlify.build.sh]
#!/usr/bin/env bash
set -e
pushd /tmp
wget https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh
chmod u+x /tmp/dotnet-install.sh
/tmp/dotnet-install.sh --channel 10.0
popd
dotnet publish -c Release -o release
[ERROR]
1:37:10 PM: Netlify Build
1:37:10 PM: ----------------------------------------------------------------
1:37:10 PM: ?
1:37:10 PM: ? Version
1:37:10 PM: @netlify/build 35.3.4
1:37:10 PM: ?
1:37:10 PM: ? Flags
1:37:10 PM: accountId: [REDACTED]
1:37:10 PM: baseRelDir: true
1:37:10 PM: buildId: [REDACTED]
1:37:10 PM: deployId: [REDACTED]
1:37:10 PM: ?
1:37:10 PM: ? Current directory
1:37:10 PM: /opt/build/repo/src/code/Client
1:37:10 PM: ?
1:37:10 PM: ? Config file
1:37:10 PM: No config file was defined: using default values.
1:37:10 PM: ?
1:37:10 PM: ? Context
1:37:10 PM: deploy-preview
1:37:10 PM: ?
1:37:10 PM: Build command from Netlify app
1:37:10 PM: ----------------------------------------------------------------
1:37:10 PM: ?
1:37:10 PM: $ ./netlify.build.sh
1:37:10 PM: /tmp /opt/build/repo/src/code/Client
1:37:10 PM: --2025-11-16 18:37:10-- https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh
1:37:10 PM: Resolving dotnet.microsoft.com (dotnet.microsoft.com)... 13.107.246.40, 2620:1ec:bdf::40
1:37:10 PM: Connecting to dotnet.microsoft.com (dotnet.microsoft.com)|13.107.246.40|:443... connected.
1:37:10 PM: HTTP request sent, awaiting response... 301 Moved Permanently
1:37:10 PM: Cookie coming from dotnet.microsoft.com attempted to set domain to dotnetwebsite.azurewebsites.net
1:37:10 PM: Cookie coming from dotnet.microsoft.com attempted to set domain to dotnetwebsite.azurewebsites.net
1:37:10 PM: Location: https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh [following]
1:37:10 PM: --2025-11-16 18:37:10-- https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh
1:37:10 PM: Resolving builds.dotnet.microsoft.com (builds.dotnet.microsoft.com)... 104.89.170.71, 104.89.170.69, 2600:1403:9c00:19::1732:708a, ...
1:37:11 PM: Connecting to builds.dotnet.microsoft.com (builds.dotnet.microsoft.com)|104.89.170.71|:443... connected.
1:37:11 PM: HTTP request sent, awaiting response... 200 OK
1:37:11 PM: Length: unspecified [application/octet-stream]
1:37:11 PM: Saving to: ‘dotnet-install.sh’
1:37:11 PM: 0K .......... .......... .......... .......... .......... 1.35M
1:37:11 PM: 50K .......... .. 22.7T=0.04s
1:37:11 PM: 2025-11-16 18:37:11 (1.68 MB/s) - ‘dotnet-install.sh’ saved [63666]
1:37:11 PM: dotnet-install: Attempting to download using aka.ms link https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100/dotnet-sdk-10.0.100-linux-x64.tar.gz
1:37:15 PM: dotnet-install: Remote file https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100/dotnet-sdk-10.0.100-linux-x64.tar.gz size is 239125653 bytes.
1:37:15 PM: dotnet-install: Extracting archive from https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.100/dotnet-sdk-10.0.100-linux-x64.tar.gz
1:37:24 PM: dotnet-install: Downloaded file size is 239125653 bytes.
1:37:24 PM: dotnet-install: The remote and local file sizes are equal.
1:37:24 PM: dotnet-install: Installed version is 10.0.100
1:37:24 PM: dotnet-install: Adding to current process PATH: `/opt/buildhome/.dotnet`. Note: This change will be visible only when sourcing script.
1:37:24 PM: dotnet-install: Note that the script does not resolve dependencies during installation.
1:37:24 PM: dotnet-install: To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
1:37:24 PM: dotnet-install: Installation finished successfully.
1:37:24 PM: /opt/build/repo/src/code/Client
1:37:25 PM: MSBuild version 17.8.43+f0cbb1397 for .NET
1:37:26 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:37:26 PM: Determining projects to restore...
1:37:26 PM: /usr/lib/dotnet/sdk/8.0.121/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(166,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 10.0. Either target .NET 8.0 or lower, or use a version of the .NET SDK that supports .NET 10.0. Download the .NET SDK from https://aka.ms/dotnet/download [/opt/build/repo/src/code/Client/CountDown.Client.csproj]
1:37:26 PM: ?
1:37:26 PM: "build.command" failed
1:37:26 PM: ----------------------------------------------------------------
1:37:26 PM: ?
1:37:26 PM: Error message
1:37:26 PM: Command failed with exit code 1: ./netlify.build.sh (https://ntl.fyi/exit-code-1)
1:37:26 PM: ?
1:37:26 PM: Error location
1:37:26 PM: In Build command from Netlify app:
1:37:26 PM: ./netlify.build.sh
1:37:26 PM: ?
1:37:26 PM: Resolved config
1:37:26 PM: build:
1:37:26 PM: base: /opt/build/repo/src/code/Client
1:37:26 PM: command: ./netlify.build.sh
1:37:26 PM: commandOrigin: ui
1:37:26 PM: edge_functions: /opt/build/repo/src/code/Client/netlify/edge-functions
1:37:26 PM: environment:
1:37:26 PM: - GOLIVE
1:37:26 PM: - REVIEW_ID
1:37:26 PM: publish: /opt/build/repo/src/code/Client/release/wwwroot
1:37:26 PM: publishOrigin: ui
1:37:26 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:37:26 PM: Failing build: Failed to build site
1:37:26 PM: Finished processing build request in 26.073s