dotnet / dotnet/msbuild

Highly misleading error messages when SDK specified in global.json can't be resolved

Open
#13,387 5 comments 4 reactions 1 assignee Claimed by @jankratochvilcz View on GitHub
backlog triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

Clone https://github.com/xoofx/ultra
(I used commit https://github.com/xoofx/ultra/commit/d68286cd706eb9232582ce568ef1e874b5dbc7f8)

on a machine without .NET SDK 8

cd src
msbuild /r /m /bl

Expected: some mention that there was a global.json used, that it specified SDK 8, and that no such SDK was found

Actual:

```
C:\Ultra\src\Ultra\Ultra.csproj Could not resolve SDK "Microsoft.NET.Sdk". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK.
Unable to locate the .NET SDK. Check that it is installed, your PATH is configured for the correct architecture, and that the version specified in global.json (if any) matches the installed version.
The NuGetSdkResolver did not resolve this SDK because there was no version specified in the project or global.json.
MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.NET.Sdk" because directory "C:\Program Files\Microsoft Visual Studio\18\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\Sdk" did not exist.
```

I really dislike this error message.

this language `the version specified in global.json (if any) matches the installed version` is really suboptimal. It should tell me the exact expected and actual state.

The last sentence about NuGetSdkResolver is highly misleading too.

We should really improve this experience, potentially just redesign this from the ground up with user in mind.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.