[release/10.0] Multi-target Microsoft.EntityFrameworkCore.Tools for net8.0, net9.0, net10.0#38210
[release/10.0] Multi-target Microsoft.EntityFrameworkCore.Tools for net8.0, net9.0, net10.0#38210AndriySvyryd wants to merge 1 commit intorelease/10.0from
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts the Microsoft.EntityFrameworkCore.Tools NuGet package metadata so NuGet resolves the correct major version of Microsoft.EntityFrameworkCore.Design based on the consuming project’s target framework (avoiding runtime MissingMethodException when installing Tools into newer TFMs).
Changes:
- Split the single dependency group into per-TFM dependency groups (
net8.0,net9.0,net10.0) with matching minimumMicrosoft.EntityFrameworkCore.Designversions. - Add
lib/net9.0/_._andlib/net10.0/_._marker files so the package advertises compatibility with those TFMs.
Reviewed changes
Copilot reviewed 1 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/EFCore.Tools/EFCore.Tools.nuspec | Adds per-TFM dependency groups to ensure the right Design major is selected for each target framework. |
| src/EFCore.Tools/lib/net9.0/. | Marker file to include/declare net9.0 lib folder in the nupkg. |
| src/EFCore.Tools/lib/net10.0/. | Marker file to include/declare net10.0 lib folder in the nupkg. |
…net10.0 Add per-TFM dependency groups in the nuspec so that the appropriate version of Microsoft.EntityFrameworkCore.Design is resolved based on the consumer's target framework: - net8.0 → Design >= 8.0.0 - net9.0 → Design >= 9.0.0 - net10.0 → Design >= 10.0.0 This prevents MissingMethodException when the Tools package pulls in a Design version incompatible with the user's other EF Core packages. Fixes #38107 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
c9d37e6 to
e632124
Compare
artl93
left a comment
There was a problem hiding this comment.
Regression, customer reported, approved.
How have we not hit this previously? Is this something we need to remember to do when we update 11 to make sure we are able to pick up 10 as well?
Before 10 we supported the previous LTS TFM in our tools and referenced the latest .Design package that also supported it. In 10 we decided to only support the current TFM for our packages, but still support the previous TFMs in tools, that's why we ended up with this discrepancy. Going forward, starting with 11, the .Tools package won't bring in the .Design package at all as it was intentionally designed to not be coupled to a particular version and the dependency was there just to save users the trouble of adding it themselves. See https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-11.0/breaking-changes#ef-tools-no-design-dep |
Fixes #38107
Description
The
Microsoft.EntityFrameworkCore.Toolsnuspec had a single dependency group fornet8.0withMicrosoft.EntityFrameworkCore.Design >= 8.0.0. When a user's project targets net10.0, NuGet selects this group and resolves to a Design version that may be incompatible with the user's other EF Core packages. This causes aMissingMethodExceptionforAbstractionsStrings.ArgumentIsEmpty(System.Object)because the method signature changed between major versions.The fix adds per-TFM dependency groups (
net8.0,net9.0,net10.0) so the correct major.minor version of Design is resolved based on the consumer's target framework.Customer impact
After upgrading to
Microsoft.EntityFrameworkCore.Tools10.0.6 on an app targeting net10.0, users runningAdd-Migration(or other PMC commands) in Visual Studio get:Workaround is to reference the appropriate version of
Microsoft.EntityFrameworkCore.Designdirectly.How found
More than 10 users reports on 10.0.6.
Regression
Yes, regression from 10.0.5. Introduced in #37731.
Testing
Tested manually.
Risk
Low. The change only affects the nuspec.