Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New dependency resolver does not handle floating versions correctly in some situations #13992

Closed
jeffkl opened this issue Dec 9, 2024 · 2 comments · Fixed by NuGet/NuGet.Client#6187
Assignees
Labels
Area:NewDependencyResolver Issues related to the new dependency graph resolver Priority:2 Issues for the current backlog. RegressionFromPreviousRTM A regression from the last RTM. Example: worked in 6.2, doesn't work in 6.3 Type:Bug
Milestone

Comments

@jeffkl
Copy link
Contributor

jeffkl commented Dec 9, 2024

NuGet Product Used

dotnet.exe, MSBuild.exe, NuGet.exe

Product Version

6.12

Worked before?

Yes, 6.11

Impact

None

Repro Steps & Context

Originally reported in https://dev.azure.com/devdiv/DevDiv/_workitems/edit/2302642

Projects that use floating versions with the new dependency resolver can have issues with resolved packages. Sometimes a version conflict is incorrectly reported.

Project1:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.*" />
  </ItemGroup>
</Project>

Project2:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.*" />
    <PackageReference Include="NLog.Extensions.Logging" Version="5.*" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Project1\Project1.csproj" />
  </ItemGroup>
</Project>

Verbose Logs

Version conflict detected for Microsoft.Extensions.Logging. Install/reference Microsoft.Extensions.Logging 6.0.0 directly to project NugetTestDemo to resolve this issue.
  Project2 -> NLog.Extensions.Logging 5.3.15 -> Microsoft.Extensions.Logging (>= 6.0.0)
  Project2 -> Microsoft.EntityFrameworkCore 6.0.36 -> Microsoft.Extensions.Logging (>= 6.0.1)

Workaround

Users can workaround the issue by setting an MSBuild property in their Directory.Build.props or an environment variable:

<Project>
  <PropertyGroup>
    <RestoreUseLegacyDependencyResolver>true</RestoreUseLegacyDependencyResolver>
  </PropertyGroup>
</Project>
@jeffkl jeffkl added Priority:2 Issues for the current backlog. Type:Bug RegressionFromPreviousRTM A regression from the last RTM. Example: worked in 6.2, doesn't work in 6.3 Area:NewDependencyResolver Issues related to the new dependency graph resolver labels Dec 9, 2024
@jeffkl jeffkl self-assigned this Dec 9, 2024
@jeffkl jeffkl added this to the 6.13 milestone Dec 16, 2024
@304NotModified
Copy link

304NotModified commented Dec 25, 2024

When is this fix gonna be released?

And this is NU1107, isn't?

@jeffkl
Copy link
Contributor Author

jeffkl commented Jan 6, 2025

When is this fix gonna be released?

And this is NU1107, isn't?

This will be in the next version of Visual Studio, 17.13, and the .NET SDK 9.0.200. Yes, the error code logged is NU1107.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:NewDependencyResolver Issues related to the new dependency graph resolver Priority:2 Issues for the current backlog. RegressionFromPreviousRTM A regression from the last RTM. Example: worked in 6.2, doesn't work in 6.3 Type:Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants