デフォルトでは、add-migrationコマンドはで移行.csファイルを作成しようとします。
- プロジェクトルート
- 移行
移行を残りのEF関連コードと一緒にプロジェクトの\Dataフォルダーに保存したいと思います。
- プロジェクトルート
- データ
- 移行
- データ
この構造で、実行すると
PM> add-migration Migration1
NuGetコンソールで、次のエラーが表示されます。
System.IO.DirectoryNotFoundException:パス'C:\ MyProjectRoot \ Migrations\201112171635110_Migration1.cs'の一部が見つかりませんでした。 System.IO .__ Error.WinIOError(Int32 errorCode、StringmaybeFullPath)で System.IO.FileStream.Init(String path、FileMode mode、FileAccess access、Int32 rights、Boolean useRights、FileShare share、Int32 bufferSize、FileOptions options、SECURITY_ATTRIBUTES secAttrs、String msgPath、Boolean bFromProxy、Boolean useLongPath) System.IO.FileStream..ctor(文字列パス、FileModeモード、FileAccessアクセス、FileShare共有、Int32 bufferSize、FileOptionsオプション) System.IO.StreamWriter.CreateFile(String path、Boolean append)で System.IO.StreamWriter..ctor(文字列パス、ブール値の追加、エンコーディングエンコーディング、Int32 bufferSize) System.IO.StreamWriter..ctor(文字列パス、ブール値の追加、エンコーディングエンコーディング) System.IO.File.InternalWriteAllText(文字列パス、文字列コンテンツ、エンコーディングエンコーディング) System.IO.File.WriteAllText(文字列パス、文字列コンテンツ)で
add-migrationコマンドを実行するときに、移行ファイルを作成する必要があるディスク上の場所を指定することはできますか?