Show a warning when the tools are used with a platform-specific app#37868
Merged
AndriySvyryd merged 7 commits intomainfrom Mar 25, 2026
Merged
Show a warning when the tools are used with a platform-specific app#37868AndriySvyryd merged 7 commits intomainfrom
AndriySvyryd merged 7 commits intomainfrom
Conversation
… app Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add warning for tools in platform-specific apps
Show a warning when the tools are used with a platform-specific app
Mar 6, 2026
AndriySvyryd
reviewed
Mar 6, 2026
…ution platform Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
AndriySvyryd
reviewed
Mar 6, 2026
…urrentPlatform Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
…m TargetFramework Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
…ct message with docs link and IDesignTimeDbContextFactory<> guidance Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/efcore/sessions/6e12c379-3c85-4c7e-a45c-5ed92f003975
…getFramework in message Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/efcore/sessions/aeeadad5-f2cb-43c0-bb20-80f4134a585d
There was a problem hiding this comment.
Pull request overview
Adds a user-facing warning in the dotnet-ef tool when the startup project targets a platform-specific TFM (e.g., net8.0-windows10.0.19041.0), to help users understand why design-time tooling may not behave as expected for certain app types.
Changes:
- Emit a warning via
Reporter.WriteWarningwhenTargetPlatformIdentifieris set or when the startup projectTargetFrameworkcontains a platform suffix (netX.Y-Zform). - Add a helper method to detect platform suffixes in TFMs.
- Introduce a new localized resource string for the warning message.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/dotnet-ef/RootCommand.cs | Emits the new platform-specific startup project warning and adds TFM platform detection helper. |
| src/dotnet-ef/Properties/Resources.resx | Adds the new warning message text as a localized resource. |
| src/dotnet-ef/Properties/Resources.Designer.cs | Adds the strongly-typed accessor for the new resource string. |
Files not reviewed (1)
- src/dotnet-ef/Properties/Resources.Designer.cs: Language not supported
roji
approved these changes
Mar 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #32835
EF tools can fail with an unhelpful exceptions when used with platform-specific apps (e.g., WinUI 3 targeting
net8.0-windows10.0.19041.0).src/dotnet-ef/RootCommand.cs: A warning is now always emitted viaReporter.WriteWarningwhen the startup project'sTargetPlatformIdentifieris not null/empty, or when theTargetFrameworkis in platform-specificnetX.Y-Zform (e.g.,net8.0-windows10.0.19041.0). The warning message always includes theTargetFrameworkvalue. AddedHasPlatformInTargetFrameworkhelper to detect thenetX.Y-ZTFM pattern.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.