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

dotnet format (latest 8) intermittently fails with "Unable to locate dotnet CLI. Ensure that it is on the PATH." #44957

Open
christophwille opened this issue Nov 19, 2024 · 5 comments
Labels
Area-External Area-Format untriaged Request triage from a team member

Comments

@christophwille
Copy link

Initially opened over at dotnet/format#2218 (forgot that it was moved...)

This started happening to our Github builds this weekend:

Image

We never had any issues whatsoever, so initially we were looking at the newly installed net90, but then found microsoft/azure-pipelines-tasks#19162 (and by extension dotnet/format#2000). However, when locking to the latest version in https://github.com/icsharpcode/ILSpy/pull/3338/files we still see "Unable to locate dotnet CLI. Ensure that it is on the PATH.".

So it wasn't the old-ish version of dotnet-format that tripped us up but it happens also with the latest 8-series one. Any ideas/pointers where to start looking next? This flakiness is annoying (but not a showstopper atm).

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-External untriaged Request triage from a team member labels Nov 19, 2024
@stevejgordon
Copy link

We are also seeing this occur randomly in GitHub actions.

@jeremy-visionaid
Copy link

Also seeing this on GitHub actions

@stevejgordon
Copy link

We've also started to see this on a second repository. It's consistently failing on the Windows GitHub worker but seems fine on Linux.

@christophwille
Copy link
Author

@hongbo-miao
Copy link

hongbo-miao commented Dec 14, 2024

Thanks @christophwille !

In my case, DOTNET_INSTALL_DIR: ${{ runner.temp }}/.dotnet instead of DOTNET_ROOT: ${{ runner.temp }}/.dotnet helps as a workaround solution ☺️

So it would be like

      - name: Set up .NET Core
        uses: actions/[email protected]
        with:
          global-json-file: path/to/global.json
        env:
          DOTNET_INSTALL_DIR: ${{ runner.temp }}/.dotnet

And it is interesting to see in the downstream step log, DOTNET_ROOT now refers to D:\a\_temp\.dotnet instead of C:\Program Files\dotnet which sometimes gives me error "Unable to locate dotnet CLI. Ensure that it is on the PATH".

dotnet format my.sln --verify-no-changes
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
  env:
    NUGET: C:\hostedtoolcache\windows\nuget.exe\6.12.1\x6[4](https://github.com/hongbo-miao/hongbomiao.com/actions/runs/12333172993/job/34421902814?pr=21563#step:6:4)/nuget.exe
    DOTNET_ROOT: D:\a\_temp\.dotnet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-External Area-Format untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

5 participants