You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.
I may have found a regression with the newest template Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0-preview1-final.
In older templates, the Program class had a method IWebHost BuildWebHost which has been replaced with IWebHostBuilder CreateWebHostBuilder.
The problem occurs when attempting to run EF migrations dotnet ef migrations add Migration1. The new template causes the following error to appear
Unable to create an object of type 'DbContext'. Add an implementation of 'IDesignTimeDbContextFactory<DbContext>' to the project, or see https://go.microsoft.com/fwlink/?linkid=851728 for additional patterns supported at design time.
There is a solution - which is to expose the IDesignTimeDbContextFactory<DbContext> as suggested in the error message - but it would be easier for everybody if EF Design tools work out of the box.
The text was updated successfully, but these errors were encountered:
The SPA templates are meant to be consistent with the other ASP.NET templates, so if you think this should change, could you report it to the https://github.com/aspnet/templating repo, explaining that you think all the web project templates should change? Or maybe some fix is needed in EF to support the new convention.
Thanks for the background. I see that EF integration with the new pattern is already being discussed at aspnet/Templating#78 so no need to follow this up.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This issue is based on my comment in #1288
I may have found a regression with the newest template
Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0-preview1-final
.In older templates, the
Program
class had a methodIWebHost BuildWebHost
which has been replaced withIWebHostBuilder CreateWebHostBuilder
.The problem occurs when attempting to run EF migrations
dotnet ef migrations add Migration1
. The new template causes the following error to appearSome digging about shows that BuildWebHost is a convention expected by Entity Framework Core Design Tools. see https://github.com/aspnet/Hosting/blob/cda9ec6fe416eaa4fdc8f72276c7b16941d9761c/shared/Microsoft.AspNetCore.Hosting.WebHostBuilderFactory.Sources/WebHostFactoryResolver.cs
There is a solution - which is to expose the
IDesignTimeDbContextFactory<DbContext>
as suggested in the error message - but it would be easier for everybody if EF Design tools work out of the box.The text was updated successfully, but these errors were encountered: