dotnet / dotnet/msbuild

NuGet SDK resolver doesn't support floating versions

Open
#3,099 2 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

I'm reporting 2 different bugs in the same issue because I think they are closely related, but I can move the second one to a different issue if they're not really related:

- Floating versions aren't supported by the NuGet SDK resolver.
- If the specified version isn't found, but the closest match is resolved, package restore succeeds, but the SDK isn't installed.

### Steps to reproduce

- Some NuGet package `My.Project.Sdk`, version 1.1.0 installed in a local feed.

- Project file
```xml

...

```

- Command line
```
dotnet restore
```

### Expected behavior
The package restore is successful and the package is used as SDK.

### Actual behavior
The package restore is successful, but the package isn't used as SDK. Error message:
```
path\to\project.csproj : error MSB4236: The SDK 'My.Project.Sdk/*' specified could not be found.
```

Specifying `Sdk="My.Project.Sdk/1"` also fails, with this message:
```
path\to\project.csproj : warning : project depends on My.Project.Sdk (>= 1.0.0) but My.Project.Sdk 1.0.0 was not found. An approximate best match of My.Project.Sdk 1.1.0 was resolved.
path\to\project.csproj : error : Failed to resolve SDK 'My.Project.Sdk/1'. Package restore was successful but a package with the ID of "My.Project.Sdk" was not installed.
path\to\project.csproj : error MSB4236: The SDK 'My.Project.Sdk/1' specified could not be found.
```

### Environment data
`dotnet msbuild /version` output:
```
Microsoft (R) Build Engine version 15.7.11.29948 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

15.7.11.29948
```

OS info:

If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):
`dotnet --version`:
```
2.1.300-preview1-008174
```

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.