Skip to content

Error: Failed to resolve the exact version number when using setup-dotnet action v4 #619

Closed
@RelevanceRo

Description

@RelevanceRo

Description:
The setup-dotnet action always fails at downloading SDK for NET 9.0.x version with:

dotnet-install: Download attempt #1 has failed: Unable to download https://builds.dotnet.microsoft.com/dotnet/Sdk/9.0/latest.version.
[52]blabla/actions/runs/4330378/job/15876247?pr=4#step:5:53)dotnet-install: Attempt #2 will start in 10 seconds.
[53]blabla/actions/runs/4330378/job/15876247?pr=4#step:5:54)dotnet-install: Download attempt #2 has failed: Unable to download https://builds.dotnet.microsoft.com/dotnet/Sdk/9.0/latest.version.
[54]blabla/actions/runs/4330378/job/15876247?pr=4#step:5:55)dotnet-install: Attempt #3 will start in 20 seconds.
[55]blabla/actions/runs/4330378/job/15876247?pr=4#step:5:56)dotnet-install: Download attempt #1 has failed: Unable to download https://ci.dot.net/public/Sdk/9.0/latest.version.
[56]blabla/actions/runs/4330378/job/15876247?pr=4#step:5:57)dotnet-install: Attempt #2 will start in 10 seconds.
[57]blabla/actions/runs/4330378/job/15876247?pr=4#step:5:58)dotnet-install: Download attempt #2 has failed: Unable to download https://ci.dot.net/public/Sdk/9.0/latest.version.
[58]blabla/actions/runs/4330378/job/15876247?pr=4#step:5:59)dotnet-install: Attempt #3 will start in 20 seconds.
[59]blabla/actions/runs/4330378/job/15876247?pr=4#step:5:60)dotnet_install: Error: Failed to resolve the exact version number.
[60]blabla/actions/runs/4330378/job/15876247?pr=4#step:5:61)Error: Failed to install dotnet, exit code: 1. dotnet_install: Error: Failed to resolve the exact version number.

Task version:
v4

Platform:

  • [x ] Ubuntu
  • macOS
  • Windows

Runner type:

  • [x ] Hosted
  • Self-hosted

Repro steps:
Use setup-dotnet action v4 to download .NET 9.0.x

Expected behavior:
I expect the action to download and install the NET 9 SDK.

Actual behavior:
The setup-dotnet action always fails at downloading SDK for NET 9.0.x version with:
Error: Failed to install dotnet, exit code: 1. dotnet_install: Error: Failed to resolve the exact version number.

This is my action in the yml of CodeQL for my repo:

name: "CodeQL"
on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]
  schedule:
    - cron: '41 10 * * 4'  # At 10:41 every Thursday

jobs:
  analyze:
    name: Analyze
    runs-on: [ ubuntu-latest ]
    timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
    permissions:
      actions: read
      contents: read
      security-events: write

    strategy:
      fail-fast: false
      matrix:
        language: [ 'csharp' ]

    steps:
    - name: Checkout repository
      uses: actions/checkout@v4
     
    # Initializes the CodeQL tools for scanning
    - name: Initialize CodeQL
      uses: github/codeql-action/init@v3
      with:
        languages: ${{ matrix.language }}
        # Query configuration
        queries: security-extended,security-and-quality
        # Configure CodeQL analysis options
        config: |
          # Configuration for all languages
          paths:
            - src
          paths-ignore:
            - '**/obj/**'
            - '**/bin/**'
            - '**/tests/**'
            - '**/*.Test*/**'
            - '**/*.Tests*/**'
         
          # C# specific configuration
          csharp:
            # Enable additional security analysis for database operations
            database-scrutiny: high
                 
          # Don't analyze test code
          query-filters:
            - exclude:
                tags contain: test    
    # Standard build using dotnet CLI
    - name: Setup .NET
      uses: actions/setup-dotnet@v4      
      with:        
        dotnet-version: '9.0.x'

    - name: Build with dotnet
      run: |
        dotnet restore BlaBla.Api.sln
        dotnet build BlaBla.Api.sln --configuration Debug --no-restore
       
    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@v3
      with:
        category: "/language:${{matrix.language}}"

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions