I am, however, getting stuck on the adding the migration section of this tutorial. When I type "Add-Migration Initial" the build starts then fails imminently.
Does the solution build? Do you get any build errors?
I tried reproducing your error and could reproduce it when building an old version of this app (with url slugs actually) and got the same migration error. I also got build errors related to TypeScript and IteratorResult.
Then I used VS Code to run ng build in the ClientApp folder and got the following error:
ERROR in src/app/blog-post-add-edit/blog-post-add-edit.component.ts:8:27 - error TS2307: Cannot find module 'path'.
8 import { delimiter } from 'path';
I simply commented out this section in blog-post-add-edit.component.ts and ran ng build again and then building worked.
I finally ran ng serve (which builds and runs the ClientApp application) and then everything worked fine.
So after some investigation, I changed line 35 of Startup.cs from "options.UseSqlServer(Configuration.GetConnectionString("BlogPostsContext")));" to "options.UseInMemoryDatabase(Configuration.GetConnectionString("BlogPostsContext")));" This allowed me to skip the section of doing "Add-Migrations Initial"
Hello Martin,
This tutorial is great!
I am, however, getting stuck on the adding the migration section of this tutorial. When I type "Add-Migration Initial" the build starts then fails imminently.
Any ideas on what is causing this?
Thanks again!
Cameron
Hi and thanks!
Does the solution build? Do you get any build errors?
I tried reproducing your error and could reproduce it when building an old version of this app (with url slugs actually) and got the same migration error. I also got build errors related to TypeScript and IteratorResult.
Then I used VS Code to run ng build in the ClientApp folder and got the following error:
ERROR in src/app/blog-post-add-edit/blog-post-add-edit.component.ts:8:27 - error TS2307: Cannot find module 'path'.
8 import { delimiter } from 'path';
I simply commented out this section in blog-post-add-edit.component.ts and ran ng build again and then building worked.
I finally ran ng serve (which builds and runs the ClientApp application) and then everything worked fine.
So after some investigation, I changed line 35 of Startup.cs from "options.UseSqlServer(Configuration.GetConnectionString("BlogPostsContext")));" to "options.UseInMemoryDatabase(Configuration.GetConnectionString("BlogPostsContext")));" This allowed me to skip the section of doing "Add-Migrations Initial"
Thanks for sharing!
Installing these packages via Nuget might solve it too:
Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.SqlServer