Fix PMC commands failing on build warnings in VS 2026#37673
Merged
AndriySvyryd merged 7 commits intomainfrom Feb 12, 2026
Merged
Fix PMC commands failing on build warnings in VS 2026#37673AndriySvyryd merged 7 commits intomainfrom
AndriySvyryd merged 7 commits intomainfrom
Conversation
…ld warnings Co-authored-by: AndriySvyryd <[email protected]>
Co-authored-by: AndriySvyryd <[email protected]>
Copilot
AI
changed the title
[WIP] Fix EF command error handling in Package Manager Console
Fix PMC commands failing on build warnings in VS 2026
Feb 11, 2026
Co-authored-by: AndriySvyryd <[email protected]>
Co-authored-by: AndriySvyryd <[email protected]>
…p it for dotnet build Co-authored-by: AndriySvyryd <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR addresses a Visual Studio 2026 regression where EF Core Package Manager Console commands fail when the build emits warnings (e.g., NuGet vulnerability warnings) due to the module’s $ErrorActionPreference = 'Stop'.
Changes:
- Wraps the
dotnet build ... /t:ResolvePackageAssetsinvocation in atry/finallyto temporarily set$ErrorActionPreferenceto'Continue'only when it was originally'Stop'. - Restores the previous
$ErrorActionPreferenceafter the build-related call completes.
Co-authored-by: Copilot <[email protected]>
roji
approved these changes
Feb 11, 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.
VS 2026 Package Manager Console now fails EF commands (add-migration, remove-migration, update-database) when the build encounters warnings like nuget package vulnerabilities. The module-level
$ErrorActionPreference = 'Stop'causes PowerShell to halt on build warnings.Changes
Wrapped the
dotnet buildCLI invocation with a try/finally block that:$ErrorActionPreference'Continue'during build when originally set to'Stop'to allow warningsBuild failures are still caught via error handling in the dotnet build invocation.
Build operation protected:
dotnet build - CLI invocation for ResolvePackageAssets (line 1409)
Users no longer need
-ErrorAction Ignoreworkaround for PMC commands that trigger the dotnet build CLI call.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.