Sometimes got error "Unable to locate dotnet CLI. Ensure that it is on the PATH" #564
Description
Description:
I found setup-dotnet
is not always reliable.
For example, in same GitHub Action build:
Attempt #1
failed: https://github.com/hongbo-miao/hongbomiao.com/actions/runs/12211957209/attempts/1Attempt #2
succeed: https://github.com/hongbo-miao/hongbomiao.com/actions/runs/12211957209
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
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.