On VS2019, C#, EF6, using the Package Manager Console, I am trying to specify the -OutputDir
for the Add-Migration
command according to this link but it always writes to the root of the project. If I remove the -OutputDir
param, it will write inside the \Migrations folder but I prefer to be inside \Migrations\MySubFolder
PM> add-migration -name CreateInitialTables -OutputDir \Migrations\MySubFolder -context MyDbContext
From the docs for Add-Migration
:
-OutputDir <String>: The directory use to output the files. Paths are relative to the target project directory. Defaults to "Migrations".
Because the path is relative, you need to specify the path without the leading slash, or use .\
to indicate the current directory. For example:
add-migration -name CreateInitialTables -OutputDir .\Migrations\MySubFolder -context MyDbContext