DenLilleMand DenLilleMand - 18 days ago 5
ASP.NET (C#) Question

How to change the output folder for migrations on asp.net Core 1.1?

Does anyone know how to change the output directory of the following command:

dotnet ef migrations add Initial --context EsportshubApi.Models.ApplicationDbContext


??

i tried to add the option:

--content-root-path 'Migrations/Identity'


but that doesn't do anything. There is a --data-dir option aswell and something else with directory, but none of them is the output for migrations.

My problem is that i have 2 DbContexts so i want their migrations separated.

Answer
dotnet ef  migrations add Initial --context EsportshubApi.Models.ApplicationDbContext -o YourFolderPath

Source

Usage: dotnet ef [options] [command]

Options:
  -h|--help                           Show help information
  -p|--project <PROJECT>              The project to target (defaults to the project in the current directory). Can be a path to a project.json or a project directory.
  -s|--startup-project <PROJECT>      The path to the project containing Startup (defaults to the target project). Can be a path to a project.json or a project directory.
  -c|--configuration <CONFIGURATION>  Configuration under which to load (defaults to Debug)
  -f|--framework <FRAMEWORK>          Target framework to load from the startup project (defaults to the framework most compatible with .NETCoreApp,Version=v1.0).
  -b|--build-base-path <OUTPUT_DIR>   Directory in which to find temporary outputs.
  -o|--output <OUTPUT_DIR>            Directory in which to find outputs

Commands:
  database    Commands to manage your database
  dbcontext   Commands to manage your DbContext types
  migrations  Commands to manage your migrations