Skip to content

Sometimes got error "Unable to locate dotnet CLI. Ensure that it is on the PATH" #564

Open
@hongbo-miao

Description

Description:

I found setup-dotnet is not always reliable.

For example, in same GitHub Action build:

Unable to locate dotnet CLI. Ensure that it is on the PATH.

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Repro steps:

    steps:
      - name: Checkout
        uses: actions/[email protected]
      - name: Set up NuGet
        uses: nuget/[email protected]
        with:
          nuget-version: 6.12.1
      - name: Set up .NET Core
        uses: actions/[email protected]
        with:
          global-json-file: hardware-in-the-loop/national-instruments/veristand/VeriStandZeroMQBridge/global.json
      - name: Install dependencies
        working-directory: hardware-in-the-loop/national-instruments/veristand/VeriStandZeroMQBridge
        run: |
          nuget restore VeriStandZeroMQBridge.sln
          dotnet tool restore
      - name: Lint C# (format)
        working-directory: hardware-in-the-loop/national-instruments/veristand/VeriStandZeroMQBridge
        run: |
          dotnet format VeriStandZeroMQBridge.sln --verify-no-changes
      - name: Lint C# (CSharpier)
        working-directory: hardware-in-the-loop/national-instruments/veristand/VeriStandZeroMQBridge
        run: |
          dotnet csharpier --check .

hardware-in-the-loop/national-instruments/veristand/VeriStandZeroMQBridge/global.json

{
  "sdk": {
    "version": "8.0.404"
  }
}

Expected behavior:

I expect dotnet CLI work all time if no code changes.

Actual behavior:

Even same code in same build, sometimes I got error "Unable to locate dotnet CLI. Ensure that it is on the PATH"

Also, for this pull request, when bumping csharpier from 0.30.2 to 0.30.3, no matter how many times I tried, I always got

Unable to locate dotnet CLI. Ensure that it is on the PATH

Build log

image

You can see dotnet CLI got installed at C:\Program Files\dotnet, but next step it says cannot find it

Unable to locate dotnet CLI. Ensure that it is on the PATH.

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