Skip to content

Incomplete information about global.json search logic #50073

@drewnoakes

Description

@drewnoakes

Type of issue

Missing information

Description

The doc says:

The .NET SDK looks for a global.json file in the current working directory (which isn't necessarily the same as the project directory) or one of its parent directories.

But the source in the SDK suggests the logic is:

  • If there is a solution file, use its directory, otherwise
  • if there is a project file, use its directory, otherwise
  • use the current working directory

The logic is here: https://github.com/dotnet/sdk/blob/6a4e43d7322bf0f96e4a766a3bec2e3b9e8b67ad/src/Resolvers/Microsoft.DotNet.MSBuildSdkResolver/MSBuildSdkResolver.cs#L422C52-L422C68

Pinging @jeffkl as an author in this area.

Page URL

https://learn.microsoft.com/en-us/dotnet/core/tools/global-json

Content source URL

https://github.com/dotnet/docs/blob/main/docs/core/tools/global-json.md

Document Version Independent Id

6d80613f-42dc-35d7-aeff-3187a36dbbca

Platform Id

8e1f5348-e2c6-2d5e-9531-202d840f33ca

Article author

@meaghanlewis

Metadata

  • ID: a94c335b-0b65-96cc-1c25-65777fbe4bb5
  • PlatformId: 8e1f5348-e2c6-2d5e-9531-202d840f33ca
  • Service: dotnet-fundamentals

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions