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

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

Open
2 of 5 tasks
hongbo-miao opened this issue Dec 8, 2024 · 2 comments
Open
2 of 5 tasks
Assignees
Labels
bug Something isn't working

Comments

@hongbo-miao
Copy link

hongbo-miao commented Dec 8, 2024

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/checkout@v4.2.2
      - name: Set up NuGet
        uses: nuget/setup-nuget@v2.0.1
        with:
          nuget-version: 6.12.1
      - name: Set up .NET Core
        uses: actions/setup-dotnet@v4.1.0
        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.

@hongbo-miao hongbo-miao added bug Something isn't working needs triage labels Dec 8, 2024
@hongbo-miao hongbo-miao changed the title Unable to locate dotnet CLI. Ensure that it is on the PATH Sometimes got error "Unable to locate dotnet CLI. Ensure that it is on the PATH" Dec 8, 2024
@mahabaleshwars
Copy link

Hello @hongbo-miao,
Thank you for creating this issue. We will investigate it and provide feedback as soon as we have some updates.

@hongbo-miao
Copy link
Author

hongbo-miao commented Dec 14, 2024

Just found more people having same issue.
I posted a workaround solution which works for me at dotnet/sdk#44957 (comment)
Also, I posted some info which may help you fix the issue. ☺️

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

3 participants