Skip to content

Conversation

@AndriySvyryd
Copy link
Member

Fixes #37230

Description
For EF 10 we started relying on the ResolvePackageAssets MSBuild task to get more accurate information about the project dependencies. However, this task is not available if the project is targeting multiple TFMs. The solution is to allow users to select which framework should be used.

Customer impact
Fir apps targeting multiple TFMs the ef tool will throw an exception when any command is invoked. The workaround to change the project to target a single TFM temporarily. However, this isn't possible in CI/CD scenarios.

How found
Multiple customer reports on EF 10.

Regression
Yes, from EF 9

Testing
Tested manually.

Risk
Low. Targeted fix that only affects design-time tools.

@AndriySvyryd AndriySvyryd requested a review from Copilot December 4, 2025 22:41
@AndriySvyryd AndriySvyryd requested a review from a team as a code owner December 4, 2025 22:41
Copilot finished reviewing on behalf of AndriySvyryd December 4, 2025 22:43
Copy link

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

This PR fixes an issue where the dotnet ef tool fails for projects targeting multiple target frameworks (multi-TFM). The fix passes framework, configuration, and runtime parameters to Project.FromFile() for both the main project and startup project, and adds a helpful error message when multi-TFM projects are detected without a specified framework.

Key changes:

  • Modified RootCommand.cs to pass framework/configuration/runtime parameters to both project and startup project initialization
  • Added HasMultipleTargetFrameworks() helper method to detect multi-TFM scenarios and provide a clear error message
  • Added MultipleTargetFrameworks resource string for the new error message

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/dotnet-ef/RootCommand.cs Updated to pass framework/configuration/runtime parameters to Project.FromFile() for the main project, matching the existing startup project initialization
src/dotnet-ef/Properties/Resources.resx Added new error message resource for multi-TFM scenario
src/dotnet-ef/Properties/Resources.Designer.cs Generated code for new resource string and minor documentation improvement for NativeAotDescription
src/dotnet-ef/Project.cs Added HasMultipleTargetFrameworks() method to detect multi-TFM projects and improved error handling with specific message
Files not reviewed (1)
  • src/dotnet-ef/Properties/Resources.Designer.cs: Language not supported

@AndriySvyryd AndriySvyryd changed the title [release/10.0] Fix empty scalar collection support (#37248) [release/10.0] Allow tools to run on projects targeting multiple frameworks Dec 4, 2025
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.

2 participants