Skip to content

[release/10.0] Multi-target Microsoft.EntityFrameworkCore.Tools for net8.0, net9.0, net10.0#38210

Open
AndriySvyryd wants to merge 1 commit intorelease/10.0from
andriysvyryd/fix-tools-multi-targeting
Open

[release/10.0] Multi-target Microsoft.EntityFrameworkCore.Tools for net8.0, net9.0, net10.0#38210
AndriySvyryd wants to merge 1 commit intorelease/10.0from
andriysvyryd/fix-tools-multi-targeting

Conversation

@AndriySvyryd
Copy link
Copy Markdown
Member

@AndriySvyryd AndriySvyryd commented May 1, 2026

Fixes #38107

Description
The Microsoft.EntityFrameworkCore.Tools nuspec had a single dependency group for net8.0 with Microsoft.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 a MissingMethodException for AbstractionsStrings.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.Tools 10.0.6 on an app targeting net10.0, users running Add-Migration (or other PMC commands) in Visual Studio get:

System.MissingMethodException: Method not found: 'System.String Microsoft.EntityFrameworkCore.Diagnostics.AbstractionsStrings.ArgumentIsEmpty(System.Object)'.

Workaround is to reference the appropriate version of Microsoft.EntityFrameworkCore.Design directly.

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.

Copilot AI review requested due to automatic review settings May 1, 2026 20:24
@AndriySvyryd AndriySvyryd requested a review from a team as a code owner May 1, 2026 20:24
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 minimum Microsoft.EntityFrameworkCore.Design versions.
  • Add lib/net9.0/_._ and lib/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>
@AndriySvyryd AndriySvyryd force-pushed the andriysvyryd/fix-tools-multi-targeting branch from c9d37e6 to e632124 Compare May 1, 2026 20:37
@AndriySvyryd AndriySvyryd requested a review from artl93 May 1, 2026 20:50
Copy link
Copy Markdown
Member

@artl93 artl93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@AndriySvyryd
Copy link
Copy Markdown
Member Author

AndriySvyryd commented May 1, 2026

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants