默認情況下,附加遷移命令嘗試在是否可以更改EF Migrations「Migrations」文件夾的位置?
- 項目以創建遷移cs文件根
- 遷移
我想沿着存儲我的遷移與我的項目的\ Data文件夾中其餘的EF相關的代碼:
- 項目根
- 數據
- 遷移
- 數據
採用這種結構,當我在的NuGet控制檯收到以下錯誤執行
PM> add-migration Migration1
:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\MyProjectRoot\Migrations\201112171635110_Migration1.cs'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at 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) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.IO.StreamWriter.CreateFile(String path, Boolean append) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding) at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding) at System.IO.File.WriteAllText(String path, String contents)
是否可以指定磁盤上執行add-migration命令時應創建遷移文件的位置?
請標記羅傑的解決方案作爲答案。它爲我工作。謝謝。 – jordanbtucker 2012-09-04 17:09:22