Skip to content

More detailed error message when SDK is not found #24480

@KirillOsenkov

Description

@KirillOsenkov

Currently when global.json specifies an SDK that's not installed, here's the error you get:

Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.

This error is not nearly detailed enough. It is also very important as it's a gateway to our entire ecosystem (think someone new to .NET clones a repo, tries to build and sees this). We need to make this first run experience as smooth as possible, and now it's anything but.

Ways I see that we can improve this message:

  1. be explicit whether there was a global.json or not, and if yes, what was the exact location
  2. which version is expected by global.json?
  3. which versions are currently installed and were reachable by the resolver?
  4. what to do next? Provide a URL that is as precise as possible to download (perhaps get the exact URL to the blob)

Long term we need to think about potentially downloading and installing the SDK automatically and on demand if it wasn't found. Perhaps ask "would you like to download and install it now?" and have a -force flag or something that does it silently (for CI scenarios). This way we can avoid having a separate Use .NET SDK CI step, and we could just do msbuild /r /ensuresdk or something to make sure we can build the repo in a single automatable step.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions