Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actions Failing to Build .NET 9.0 Project #562

Open
2 of 5 tasks
ZjzMisaka opened this issue Nov 23, 2024 · 11 comments
Open
2 of 5 tasks

GitHub Actions Failing to Build .NET 9.0 Project #562

ZjzMisaka opened this issue Nov 23, 2024 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@ZjzMisaka
Copy link

Description:
I recently updated my project to target .NET 9.0 after its release. I modified the csproj file to set the TargetFramework to .NET 9.0 and successfully built the project on my local machine. However, after committing the changes, the GitHub Actions workflow fails during the build step with the following error:

The current .NET SDK does not support targeting .NET 9.0. Either target .NET 8.0 or lower, or use a version of the .NET SDK that supports .NET 9.0. Download the .NET SDK from https://aka.ms/dotnet/download

This suggests that the version of the .NET SDK being used in the GitHub Actions environment does not yet support .NET 9.0.

Questions:

  1. Is .NET 9.0 supported in GitHub Actions?
  2. Do I need to configure my workflow specifically for .NET 9.0?

Task version:
actions/setup-dotnet@v3

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Repro steps:
https://github.com/ZjzMisaka/PowerThreadPool/blob/main/.github/workflows/test.yml

Expected behavior:
Successfully build

Actual behavior:
Build step with the following error:

The current .NET SDK does not support targeting .NET 9.0. Either target .NET 8.0 or lower, or use a version of the .NET SDK that supports .NET 9.0. Download the .NET SDK from https://aka.ms/dotnet/download
@ZjzMisaka ZjzMisaka added bug Something isn't working needs triage labels Nov 23, 2024
@hongbo-miao
Copy link

hongbo-miao commented Nov 24, 2024

I may get a similar issue (?)

When I upgrade global.json from

{
  "sdk": {
    "version": "8.0.404",
    "quality": "release"
  }
}

to

{
  "sdk": {
    "version": "9.0.100",
    "quality": "release"
  }
}

I got error in my build:

Unhandled exception: System.Exception: The build host could not be found at '/usr/share/dotnet/sdk/9.0.100/DotnetTools/dotnet-format/BuildHost-net472/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.exe'
   at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.AssertBuildHostExists(String buildHostPath)
   at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.GetDotNetFrameworkBuildHostPath()
   at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.CreateMonoBuildHostStartInfo()
   at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.GetBuildHostAsync(BuildHostProcessKind buildHostKind, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.GetBuildHostWithFallbackAsync(BuildHostProcessKind buildHostKind, String projectOrSolutionFilePath, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.LoadProjectFileInfosAsync(String projectPath, DiagnosticReportingOptions reportingOptions, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.LoadProjectInfosFromPathAsync(String projectPath, DiagnosticReportingOptions reportingOptions, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.LoadAsync(CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.LoadSolutionInfoAsync(String solutionFilePath, IProgress`1 progress, ILogger msbuildLogger, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.LoadSolutionInfoAsync(String solutionFilePath, IProgress`1 progress, ILogger msbuildLogger, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.OpenSolutionAsync(String solutionFilePath, ILogger msbuildLogger, IProgress`1 progress, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.Workspaces.MSBuildWorkspaceLoader.LoadAsync(String solutionOrProjectPath, WorkspaceType workspaceType, String binaryLogPath, Boolean logWorkspaceWarnings, ILogger logger, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.CodeFormatter.OpenMSBuildWorkspaceAsync(String solutionOrProjectPath, WorkspaceType workspaceType, Boolean noRestore, Boolean requiresSemantics, String binaryLogPath, Boolean logWorkspaceWarnings, ILogger logger, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.CodeFormatter.FormatWorkspaceAsync(FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken, String binaryLogPath)
   at Microsoft.CodeAnalysis.Tools.FormatCommandCommon.FormatAsync(FormatOptions formatOptions, ILogger`1 logger, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.Commands.RootFormatCommand.FormatCommandDefaultHandler.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
   at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)

image

@aparnajyothi-y
Copy link

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

@ZjzMisaka
Copy link
Author

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

Hi, thank you for the help, is there any progress, or something need my help?

@mahalakshmi-rekadi
Copy link

mahalakshmi-rekadi commented Dec 4, 2024

Hello @ZjzMisaka,
GitHub Actions supports .NET 9.0, but to use it, you need to install it externally and configure your workflow to use the correct SDK version. Since ubuntu-latest runners support up to .NET 8.0 version, you need to specify the .NET 9.0 SDK version in actions/setup-dotnet@v4 step.

Workflow Configuration:
To resolve this, update your workflow file to specify the .NET 9.0 SDK version as shown below:

steps:

  • uses: actions/checkout@v4
    name: Checkout code
  • name: Setup .NET
    uses: actions/setup-dotnet@v4
    with:
    dotnet-version: 9.0.x
  • name: Restore dependencies
    run: dotnet restore PowerThreadPool/PowerThreadPool.csproj
  • name: Build
    run: dotnet build PowerThreadPool/PowerThreadPool.csproj --no-restore

1.The specified Target Framework Monikers (TFMs) indicate compatibility with multiple .NET versions.
2.The .NET SDK version in the workflow determines the highest framework version supported during the build process.
3.Using the .NET 9.0 SDK ensures compatibility with all specified TFMs, including the newest framework versions.

For more details, refer to the Select which .NET version to use - .NET | Microsoft Learn.

Please let us know if you have any further questions or need additional support

@ZjzMisaka
Copy link
Author

ZjzMisaka commented Dec 4, 2024

@mahalakshmi-rekadi Thank you, your suggestion works well. However, I’d like to know if the ubuntu-latest runner will support .NET 9.0 in the near future?
If native support for .NET 9.0 becomes available, I can re-run the previously failed Actions. While new GitHub Actions are running successfully, the failed ones remain in a failed state.

@hongbo-miao
Copy link

hongbo-miao commented Dec 4, 2024

(I saw @ZjzMisaka 's change at https://github.com/ZjzMisaka/PowerThreadPool/pull/81/files and succeed. Strange, mine still failed, I will test more and if still no luck, will create a new ticket as @ZjzMisaka 's original question has been resolved. Thanks!)

@ZjzMisaka
Copy link
Author

@hongbo-miao I'm not sure but maybe you should try to add this?

      - name: Setup .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 9.0.x

@hongbo-miao
Copy link

hongbo-miao commented Dec 4, 2024

(Thanks @ZjzMisaka @mahalakshmi-rekadi for helping! Glad @ZjzMisaka 's original issue has been resolved. However, I was happy too early as I found my issue is complete different. I posted details at #563)

@mahalakshmi-rekadi
Copy link

Hello @ZjzMisaka ,

The timeline for native support of .NET 9.0 on ubuntu-latest is not specified.

If .NET 9.0 support becomes available, you can re-run the failed Actions to see if they pass. For now, continue specifying the .NET 9.0 SDK version in your workflow as recommended.

To stay updated on supported software versions for GitHub Actions runners, check these resources:

GitHub Actions Runner Images
GitHub Actions Blog

Please feel free to reach out if you have any concerns or need additional assistance.

Thanks!

@ZjzMisaka
Copy link
Author

@mahalakshmi-rekadi Hi,
My action failed again and this time the log shows the following

App: /home/runner/work/PowerThreadPool/PowerThreadPool/UnitTest/bin/Debug/net6.0/testhost.dll
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '6.0.0' (x64)
.NET location: /usr/share/dotnet/
The following frameworks were found:
  8.0.11 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  9.0.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Learn more:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=x64&rid=linux-x64&os=ubuntu.[24](https://github.com/ZjzMisaka/PowerThreadPool/actions/runs/12430730648/job/34726171175#step:4:25).04
. Please check the diagnostic logs for more information.

Does that mean ubuntu-latest does not natively support .NET 6.0 now? should I edit test.yml again, or just wait?

@ZjzMisaka ZjzMisaka reopened this Dec 20, 2024
@ZjzMisaka
Copy link
Author

ZjzMisaka commented Dec 23, 2024

I found that this issue occurs when switching to use ubuntu-24.04 in the ubuntu-latest pipelines.


Update: I temporarily resolved this issue by upgrading the project's TargetFramework from NET6 to NET8. However, I still don't want GitHub Actions to have failure records caused by environmental factors.

May I ask if this issue will be resolved in the future, allowing me to rerun the Action to clear the existing failure records?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants