xModelSnapshot.cs not respecting '--output-dir' parameter for 'dotnet ef'?
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
Research direction
Start by reproducing the documented dotnet ef migrations add command with --output-dir and inspect the verbose paths for the migration and DatabaseModelSnapshot.cs. Trace the migration output and snapshot-writing entry points, then verify with a focused test or reproduction that the documented output-directory behavior is consistent for both files, or identify the documentation change required.
Written by the indexing model from the issue text.
Description
Related but not the same issue? #10036
The documentation at Entity Framework Core tools reference states:
--output-dir <PATH> - The directory use to output the files. [...]
However when running:
dotnet ef migrations add InitialCreate --project src\Infrastructure --startup-project src\DatabaseMigration --output-dir ..\DatabaseMigration\Migrations --verbose
Only the migrations files are put in the output directory. My DbContext is called Database, and the file called DatabaseModelSnapshot.cs is put under src\Infrastructure\Migrations\DatabaseModelSnapshot.cs.
Is this a bug in the dotnet ef code, or an error in the documentation?
Verbose output:
dotnet exec --depsfile xxx\src\DatabaseMigration\bin\Debug\net5.0\Application1.DatabaseMigration.deps.json --additionalprobingpath C:\Users\my-user\.nuget\packages --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" --runtimeconfig xxx\src\DatabaseMigration\bin\Debug\net5.0\Application1.DatabaseMigration.runtimeconfig.json C:\Users\my-user\.dotnet\tools\.store\dotnet-ef\5.0.3\dotnet-ef\5.0.3\tools\netcoreapp3.1\any\tools\netcoreapp2.0\any\ef.dll migrations
add InitialCreate --output-dir ..\DatabaseMigration\Migrations --assembly xxx\src\DatabaseMigration\bin\Debug\net5.0\Application1.Infrastructure.dll --startup-assembly xxx\src\DatabaseMigration\bin\Debug\net5.0\Application1.DatabaseMigration.dll --project-dir xxx\src\Infrastructure\ --language C# --working-dir xxx --verbose --root-namespace Application1.Infrastructure
Using assembly 'Application1.Infrastructure'.
Using startup assembly 'Application1.DatabaseMigration'.
Using application base 'xxx\src\DatabaseMigration\bin\Debug\net5.0'.
Using working directory 'xxx\src\DatabaseMigration'.
Using root namespace 'Application1.Infrastructure'.
Using project directory 'xxx\src\Infrastructure\'.
Remaining arguments: .
Finding DbContext classes...
Finding IDesignTimeDbContextFactory implementations...
Finding application service provider in assembly 'Application1.DatabaseMigration'...
Finding Microsoft.Extensions.Hosting service provider...
No static method 'CreateHostBuilder(string[])' was found on class 'Program'.
No application service provider was found.
Finding DbContext classes in the project...
Found DbContext 'Database'.
Using context 'Database'.
Database is not configured. Configuring from environment..
Finding design-time services for provider 'Microsoft.EntityFrameworkCore.SqlServer'...
Using design-time services from provider 'Microsoft.EntityFrameworkCore.SqlServer'.
Finding design-time services referenced by assembly 'Application1.DatabaseMigration'...
Finding design-time services referenced by assembly 'Application1.Infrastructure'...
No referenced design-time services were found.
Finding IDesignTimeServices implementations in assembly 'Application1.DatabaseMigration'...
No design-time services were found.
DetectChanges starting for 'Database'.
DetectChanges completed for 'Database'.
Writing migration to 'xxx\src\DatabaseMigration\Migrations\20210308082724_InitialCreate.cs'.
Writing model snapshot to 'xxx\src\Infrastructure\Migrations\DatabaseModelSnapshot.cs'.
'Database' disposed.
Version info
dotnet --version: 5.0.102
dotnet ef --version: Entity Framework Core .NET Command-line Tools 5.0.3
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 134
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/efcore
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
customer-reported
Difficulty 5/5 Over a week Newbie friendliness 38/100
-
area-cosmos area-vector-search
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
area-cosmos
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
area-tools needs-design
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·
-
area/docs-content Bug pulumi/docs
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100