actions / setup-dotnet

Set up your GitHub Actions workflow with a specific version of the .NET core sdk
MIT License
918 stars 451 forks source link

Infrequent "MSB4236: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found" errors with ubuntu 24.04 hosted runner. #531

Open foriequal0 opened 3 weeks ago

foriequal0 commented 3 weeks ago

Description:

Infrequent 'MSB4236: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found' with ubuntu 24.04 hosted runner. The error happens in projects with <Project Sdk="Microsoft.NET.Sdk.Web"> only (<Project Sdk="Microsoft.NET.Sdk"> are fine)

Task version: v4.0.0

Platform:

Runner type:

Repro steps:

actions:

  test:
    runs-on: [ubuntu-24.04]
    env:
      DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1
    steps:
      - uses: actions/checkout@v4
        timeout-minutes: 1
      - uses: actions/setup-dotnet@v4
        with:
          dotnet-version: "7.0.x"
        timeout-minutes: 1
      - run: dotnet restore
      - run: dotnet build --no-restore

global.json:

{
  "sdk": {
    "version": "7.0.202",
    "rollForward": "latestFeature"
  }
}

some-proj.csproj

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
  </PropertyGroup>

  ...

</PropertyGroup>

Trigger the action.

Expected behavior: build succeed.

Actual behavior:

Sometime build error only on projects with "Microsoft.NET.Sdk.Web"

/home/runner/work/.../some-proj1.csproj : error : Could not resolve SDK "Microsoft.NET.Sdk.Web". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK.
/home/runner/work/.../some-proj2.csproj : error :   
/home/runner/work/.../some-proj3.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.
/home/runner/work/.../some-proj4.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.
...
    0 Warning(s)
    20 Error(s)

This is the setup-dotnet action log

/home/runner/work/_actions/actions/setup-dotnet/v4/externals/install-dotnet.sh --skip-non-versioned-files --runtime dotnet --channel LTS
dotnet-install: Attempting to download using aka.ms link https://dotnetcli.azureedge.net/dotnet/Runtime/8.0.6/dotnet-runtime-8.0.6-linux-x64.tar.gz
dotnet-install: Remote file https://dotnetcli.azureedge.net/dotnet/Runtime/8.0.6/dotnet-runtime-8.0.6-linux-x64.tar.gz size is 31270581 bytes.
dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Runtime/8.0.6/dotnet-runtime-8.0.6-linux-x64.tar.gz
cp: warning: behavior of -n is non-portable and may change in future; use --update=none instead
cp: warning: behavior of -n is non-portable and may change in future; use --update=none instead
dotnet-install: Downloaded file size is 31270581 bytes.
dotnet-install: The remote and local file sizes are equal.
dotnet-install: Installed version is 8.0.6
dotnet-install: Adding to current process PATH: `/usr/share/dotnet`. Note: This change will be visible only when sourcing script.
dotnet-install: Note that the script does not resolve dependencies during installation.
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.
dotnet-install: Installation finished successfully.
/home/runner/work/_actions/actions/setup-dotnet/v4/externals/install-dotnet.sh --skip-non-versioned-files --channel 7.0
dotnet-install: Attempting to download using aka.ms link https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.410/dotnet-sdk-7.0.410-linux-x64.tar.gz
dotnet-install: Remote file https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.410/dotnet-sdk-7.0.410-linux-x64.tar.gz size is 218499912 bytes.
dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.410/dotnet-sdk-7.0.410-linux-x64.tar.gz
cp: warning: behavior of -n is non-portable and may change in future; use --update=none instead
cp: warning: behavior of -n is non-portable and may change in future; use --update=none instead
cp: warning: behavior of -n is non-portable and may change in future; use --update=none instead
cp: warning: behavior of -n is non-portable and may change in future; use --update=none instead
cp: warning: behavior of -n is non-portable and may change in future; use --update=none instead
cp: warning: behavior of -n is non-portable and may change in future; use --update=none instead
cp: warning: behavior of -n is non-portable and may change in future; use --update=none instead
cp: warning: behavior of -n is non-portable and may change in future; use --update=none instead
cp: warning: behavior of -n is non-portable and may change in future; use --update=none instead
dotnet-install: Downloaded file size is 218499912 bytes.
dotnet-install: The remote and local file sizes are equal.
dotnet-install: Installed version is 7.0.410
dotnet-install: Adding to current process PATH: `/usr/share/dotnet`. Note: This change will be visible only when sourcing script.
dotnet-install: Note that the script does not resolve dependencies during installation.
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.
dotnet-install: Installation finished successfully.
aparnajyothi-y commented 3 weeks ago

Hello @foriequal0, Thank you for creating this issue and we will look into it :)