Repository navigation
Add an EFMigrationsOutputDir project property as the default --output-dir - #39568
Draft
ajcvickers wants to merge 7 commits into
Draft
ajcvickers wants to merge 7 commits into
ajcvickers wants to merge 7 commits into
Conversation
ajcvickers
force-pushed
the
feature/35069-migrations-output-dir-property
branch
2 times, most recently
from
November 15, 2026 10:41
0cb5624 to
178d66b
Compare
ajcvickers
force-pushed
the
feature/35069-migrations-output-dir-property
branch
2 times, most recently
from
December 1, 2026 19:31
069adc6 to
b35c9f8
Compare
migrations remove only searched under the project directory, so it could not find migration or snapshot files placed outside of it with --output-dir, and it silently re-created a second snapshot. Add an optional --output-dir/-OutputDir as an extra place to look, and warn when the snapshot has to be re-created. Part of dotnet#32738 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…utputDir Part of dotnet#32738 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…errides of RemoveMigration working - migrations remove now throws, before changing anything, when neither the migration file nor the snapshot file can be found, and names --output-dir. - Locate the snapshot by namespace and class, and fail when it is declared in several files. - Add a default interface implementation for the new IMigrationsScaffolder.RemoveMigration overload, and keep calling the original overload when there is no output directory so overrides still take effect. - Create the directory when remove has to write a new snapshot. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…th outputDir Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ions remove With --force on an applied migration, the files not found check ran after the migration had been reverted, so the command could revert the database and then report that nothing was removed. The files are now looked up first. Also match snapshot declarations in namespaces that have escaped identifiers (App.@event), and only require a C# class declaration when the code generator is the C# one, so that the snapshot of other languages is found by name as before. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
dotnet ef migrations add (and database update --add) use the property when --output-dir is not specified, so the location no longer has to be repeated on every command. Fixes dotnet#35069 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…, and report its use - Pass the property to migrations remove so files outside the project can be found. - Trim whitespace and normalize directory separators, like the other project properties. - Report the directory taken from the property as information, since it can move the snapshot. - Document that the property applies to every DbContext in the project. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ajcvickers
force-pushed
the
feature/35069-migrations-output-dir-property
branch
from
December 2, 2026 13:03
b35c9f8 to
84bd2a2
Compare
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.
Stacked on #39567 (which is stacked on #39565). Until those merge, this PR also shows their commits; the new ones are the last two ("Add EFMigrationsOutputDir project property as the default --output-dir" and "Apply EFMigrationsOutputDir to migrations remove..."). It is a draft for that reason.
Adds an optional
EFMigrationsOutputDirMSBuild property in the migrations project.dotnet-efreads it and uses it as--output-dirformigrations add,database update --addandmigrations removewhen none is given on the command line, so a project whose migrations are not in the defaultMigrationsfolder doesn't need the option on every command. It matters more now that the snapshot follows--output-dir, andremoveneeds to find the files again.-o,--output-dir,--output-dir=Xor-o:Xalways wins. Other commands are not affected.dotnet-efsays so at information level, because it can move the snapshot.DbContextin the project, so the README recommends leaving it unset when there is more than one context. The Package Manager Console commands don't use it yet.Fixes #35069
🤖 Generated with Claude Code