These are chat archives for PomeloFoundation/Home

25th
Aug 2017
Adrien Borderon
@aborderon
Aug 25 2017 14:32

Hello, I'm coming to you about a problem with ASP.NET core 2.0 and EntityFramework Core 2.0.

I can not execute migrations with dotnet cli.

I have configured my .csproj file with the EntityFramework dependencies:
<ItemGroup> <PackageReference Include = "Microsoft.AspNetCore.All" Version = "2.0.0" /> </ ItemGroup> <ItemGroup> <PackageReference Include = "Pomelo.EntityFrameworkCore.MySql" Version = "2.0.0-rtm-10058" /> <PackageReference Include = "Pomelo.EntityFrameworkCore.MySql.Design" Version = "1.1.2" /> </ ItemGroup> <ItemGroup> <DotNetCliToolReference Include = "Microsoft.EntityFrameworkCore.Tools.DotNet" Version = "2.0.0" /> <DotNetCliToolReference Include = "Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version = "2.0.0" /> </ ItemGroup>
I configured my DbContext with DI in the statup.cs file :
Services.AddDbContext <ApplicationDbContext> (options => options.UseMySql (Configuration.GetConnectionString ("MySQLConnection"));
But when I launch :
"Dotnet ef migrations add InitialCreate"

I have the following errors:
An error occurred while calling method 'BuildWebHost' on class 'Program'. Continuing without the application service provider. Error: Could not find file '/home/aborderon/workdir/Preconeo/ibis/ibis-core-api/src/IBISCoreAPI/bin/Debug/netcoreapp2.0/ef.xml'.
Unable to create an object of type 'ApplicationDbContext'. Add an implementation of 'IDesignTimeDbContextFactory <ApplicationDbContext>' to the project, or see https://go.microsoft.com/fwlink/?linkid=851728 for additional patterns supported at design time.

sorry for my bad english ...