In an ASP.NET Core application with migrations, running update database gives the following output. It works, and the verbose output displays the default values for a variety of options.
dotnet ef --verbose database update
Setting the data directory to 'C:\temp\bin\Debug\netcoreapp1.0\'.
Invoking dependency command 'Microsoft.EntityFrameworkCore.Design' in project '2016-101DP-TreeGame-Auth'
Running C:\Program Files\dotnet\dotnet.exe exec
--runtimeconfig C:\temp\bin\Debug\netcoreapp1.0\temp.runtimeconfig.json
--depsfile C:\temp\bin\Debug\netcoreapp1.0\temp.deps.json
--additionalprobingpath C:\Users\me\.nuget\packages C:\Users\me\.nuget\packages\Microsoft.EntityFrameworkCore.Design\1.0.0-preview2-final\lib\netcoreapp1.0\Microsoft.EntityFrameworkCore.Design.dll
--assembly C:\temp\bin\Debug\netcoreapp1.0\temp.dll
--startup-assembly C:\temp\bin\Debug\netcoreapp1.0\temp.dll
--dispatcher-version 1.0.0-preview2-21431
--data-dir C:\temp\bin\Debug\netcoreapp1.0\
--project-dir C:\temp
--content-root-path C:\temp
--root-namespace temp
--verbose update database
Process ID: 12544
Finding DbContext classes...
Using context 'ApplicationDbContext'.
Done.
When I try to run the same command with options, the CLI complains that my options have "unexpected values." Here are two examples.
dotnet ef --data-dir C:\temp\bin\Debug\netcoreapp1.0\ --verbose database update
dotnet ef --data-dir "C:\temp\bin\Debug\netcoreapp1.0\" --verbose database update
Both tell me this:
Microsoft.Extensions.CommandLineUtils.CommandParsingException: Unexpected value 'C:\temp\bin\Debug\netcoreapp1.0\' for option 'data-dir'
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Cli.Program.Main(String[] args)
What are the rules for expected values to the dotnet ef
commands?
There are two layers. dotnet-ef
reads metadata from the project (and builds it) then calls ef
using that metadata (including the output assembly paths). You cannot specify the following options from dotnet ef
since they are determined for you.
--assembly
--startup-assembly
--data-dir
--project-dir
--content-root-path
--root-namespace
The rest of the options that show up in dotnet ef --help
can be specified on dotnet ef
.
This should get better as part of issue #6592.
Here is some documentation about dotnet ef.