dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.8k stars 3.2k forks source link

"Microsoft.CodeAnalysis.Common (= 4.8.0)" conflicts with other packages using newer versions. #35143

Closed NinjataWRLD closed 2 days ago

NinjataWRLD commented 3 days ago

Summary EF Core Design's dependency on Microsoft.CodeAnalysis.Common (= 4.8.0) causes conflicts with other libraries, which use the newest version (4.11.0). This results in warnings about dependency mismatches:

Detected package version outside of dependency constraint: Microsoft.CodeAnalysis.Workspaces.MSBuild 4.8.0 requires Microsoft.CodeAnalysis.Common (= 4.8.0) but version Microsoft.CodeAnalysis.Common 4.11.0 was resolved.

While the app compiles and runs without errors, this could lead to runtime issues in scenarios where EF Core Design or the conflicting library requires specific features or behaviors from their respective versions of Microsoft.CodeAnalysis.Common.

Proposed Solution Consider updating EF Core Design's dependency constraints to >= 4.8.0 instead of = 4.8.0, or update to a newer version compatible with the latest libraries.

Steps to Reproduce

  1. Create a project with EF Core Design v9.0 and Wolverine 3.3 (or any other library with a dependency on Microsoft.CodeAnalysis.Common v4.11).
  2. Observe the dependency conflict warning during restore or build.

Impact This restrictive dependency constraint creates avoidable warnings and potential runtime issues in projects integrating multiple libraries.

Thank you for considering this improvement!

AndriySvyryd commented 2 days ago

Duplicate of https://github.com/dotnet/efcore/issues/34637

As a workaround add a direct dependency on Microsoft.CodeAnalysis.Workspaces.MSBuild 4.11.0 and related packages to your project.