dotnet / dotnet/sdk

SDK resolver should emit a clear message when failing to resolve due to prerelease status

Open
#51,559 3 comments 1 reaction 1 assignee Assigned to @Copilot View on GitHub
Area-NetSDK Area-SdkResolvers Area-VS
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Is your feature request related to a problem? Please describe.

On an Azure DevOps machine that had VS 2022 installed and .NET 9 and 10 set up via the `UseDotNet@2` task, SDK resolution failed with

```
The "Microsoft.DotNet.MSBuildSdkResolver" resolver attempted to resolve the SDK "Microsoft.NET.Sdk".
Warnings: null
Errors: 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.
```

Adding a `global.json` with

```json
{
"allowPrerelease": "true"
}
```

worked.

### Describe the solution you'd like

I'd love to see a clear error here that an SDK was found but rejected because of the allow-prerelease configuration.

### Additional context

I'm not sure if this is in the hostfxr or resolver layers, but the UX is controlled here.

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.