Search code examples
.netazure-devopsyamlazure-pipelinesazure-pipelines-yaml

.NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents


Updated my application to .NET 8. Getting an error in Azure pipeline. YAML looks like this

steps:
  - task: UseDotNet@2
    displayName: 'Install .NET Core runtime'
    inputs:
      packageType: "runtime"
      version: "8.0.6"
  - task: UseDotNet@2
    displayName: "Using DotNet@2"
    inputs:
      packageType: "sdk"
      version: "8.0.302"
  - task: DotNetCoreCLI@2
    displayName: "Install dotnet format"
    inputs:
      command: "custom"
      custom: "tool"
      arguments: "update -g dotnet-format"
  - task: DotNetCoreCLI@2
    displayName: "Lint dotnet"
    inputs:
      command: "custom"
      custom: "format"
      arguments: "--check --verbosity diagnostic"
      workingDirectory: backend

Each task is successful but getting an error shown below:

.NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents..... /opt/hostedtoolcache/dotnet/dotnet format --check --verbosity diagnostic

Unhandled exception: System.IO.FileNotFoundException: The file '--check' does not appear to be a valid project or solution file.

What's causing the issue? Am i missing something?


Solution

  • According to GitHub issue #30102, --check has been replaced by --verify-no-changes.

    To verify that all code is correctly formatted, run:

    dotnet format --verify-no-changes
    

    This should fix your task:

    - task: DotNetCoreCLI@2
      displayName: "Lint dotnet"
      inputs:
        command: "custom"
        custom: "format"
        arguments: "--verify-no-changes --verbosity diagnostic"
        workingDirectory: backend
    

    For more details and examples see the dotnet format command documentation.