Skip to content

Could not resolve SDK location on mac #83469

@yamachu

Description

@yamachu

Description

ref?: #79237
ref?: dotnet/sdk#30546

When I try to run dotnet tools, like dotnet-format, it fails to resolve the sdk.

Reproduction Steps

  1. LANG=en_US.UTF-8 dotnet new console -o sample
  2. cd sample/
  3. LANG=en_US.UTF-8 dotnet format
# ~/Projects/github.com/yamachu $
 LANG=en_US.UTF-8 dotnet new console -o sample
The template "Console App" was created successfully.

Processing post-creation actions...
Restoring /Users/yamachu/Projects/github.com/yamachu/sample/sample.csproj:
  Determining projects to restore...
  Restored /Users/yamachu/Projects/github.com/yamachu/sample/sample.csproj (in 32 ms).
Restore succeeded.


# ~/Projects/github.com/yamachu $
 cd sample/
# ~/Projects/github.com/yamachu/sample $
 LANG=en_US.UTF-8 dotnet format
No .NET SDKs were found.

Download a .NET SDK:
https://aka.ms/dotnet/download

Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-found
Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer.

Expected behavior

dotnet-format works

Actual behavior

dotnet-format does not work due to fail to resolve sdks

Regression?

No response

Known Workarounds

No response

Configuration

  • dotnet 7.0.202
    • sdks
      • 6.0.201 [/usr/local/share/dotnet/sdk]
      • 7.0.101 [/usr/local/share/dotnet/sdk]
      • 7.0.200 [/usr/local/share/dotnet/sdk]
      • 7.0.202 [/usr/local/share/dotnet/sdk]
  • macOS 13.2.1
    • arm64
  • $DOTNET_ROOT is empty
$ cat /etc/dotnet/install_location /etc/dotnet/install_location_arm64 /etc/dotnet/install_location_x64
/usr/local/share/dotnet/x64
/usr/local/share/dotnet
/usr/local/share/dotnet/x64

Other information

The following gist shows the results of running the following command.

$ COREHOST_TRACE=1 dotnet format

https://gist.github.com/yamachu/18773fb0bf9443c289664cb9b28aa737

The code searching the sdk seems to be as follows.

get_framework_and_sdk_locations(dotnet_root, /*disable_multilevel_lookup*/ true, &locations);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions