If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running 'Add-Migration InitialModel' again. This snapshot is used to calculate the changes to your model when you scaffold the next migration. The Designer Code for this migration file includes a snapshot of your current Code First model. However, if I skip the enamble-migrations command and simply run the application the database is successfully created (but, of course, no Migrations directory in the project directory).ĭoes anybody know how to solve this issue so that I can continue the Code-First part of the course?Īfter I de-installed SQL Server 2019 Developer and installed SQL Server Express I could run the following commands successfully: PM> enable-migrationsĬode First Migrations enabled for project CF_NewDB. The line “Checking if the context targets an existing database…” takes a while and the path should have been created by the enable-migrations command. I believe the “Could not find file” error is a red herring. Using VS Community 2019 and SQL Server 2019 Developer. My connection string in App.config (which I took from the DatabaseFirstDemo App.config file): System.IO.FileNotFoundException: Could not find file 'C:\Users\Arjen\Source\Repos\CodeFirstDemo\Migrations'.įile name: 'C:\Users\Arjen\Source\Repos\CodeFirstDemo\Migrations'Īt System.IO._Error.WinIOError(Int32 errorCode, String maybeFullPath)Īt System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)Īt System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)Īt .(ScaffoldedMigration scaffoldedMigration, Boolean rescaffolding, Boolean force, String name)Īt .()Īt .CommandLineApplication.Execute(String args)Īt .Program.Main(String args)Ĭould not find file 'C:\Users\MyName\Source\Repos\CodeFirstDemo\Migrations'. When following the video “ Demo -Code-first Workflow” I got the following error when running enable-migrations in the Package Manager Console: PM> enable-migrationsĬhecking if the context targets an existing database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |