Open rowanmiller opened 7 years ago
We suspect the issue is that the dotnet ef
command call, that Publish calls to get the script, needs to specify --project
to specify which project the migrations are in.
cc @bricelam
/cc @vijayrkn
@rowanmiller - For generating the sql script, we run the following command from the project working directly - dot ef migrations script --idempotent --output
we don't currently pass the project name. Is there an EF command that exposes this info? If EF already knows about this, is it possible for EF to infer this info while generating the script?
Running into this exact same issue. It sounds like publishing using the Entity Framework Migrations is not currently possible when migrations are in a different assembly, but would be a great feature to be able to take advantage of.
Fixed with aspnet/EntityFramework#7741. Will be released as part of EF Core versions 1.0.4 and 1.1.2.
Originally reported by @Allann on https://github.com/aspnet/EntityFramework/issues/7169
Steps to reproduce
Not sure how easy this will be, but:
services.AddDbContext<MaintenanceContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"), b => b.MigrationsAssembly("Jbssa.FreightRates.Maintenance.Data")));
)The issue
Describe what is not working as expected.
Receive error in Error LIst in VS2015 U3. Error Your target project 'Jbssa.FreightRates.Web' doesn't match your migrations assembly 'Jbssa.FreightRates.Rates.Data'. Either change your target project or change your migrations assembly. Jbssa.FreightRates.Web 0
Error Change your migrations assembly by using DbContextOptionsBuilder. E.g. options.UseSqlServer(connection, b => b.MigrationsAssembly("Jbssa.FreightRates.Web")). By default, the migrations assembly is the assembly containing the DbContext. Jbssa.FreightRates.Web 0
Further technical details
EF Core version: (found in project.json) "dependencies": { "Jbssa.FreightRates.Maintenance.Domain": "1.0.0-", "Jbssa.ApplicationData.Reference.Domain": "1.0.0-", "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0", "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0", "NETStandard.Library": "1.6.1", "Microsoft.AspNetCore.Http.Abstractions": "1.1.0", "System.Linq": "4.3.0", "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final", "Jbssa.Application.SharedKernel.Data": "0.1.0" },
"tools": { "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final" },
"frameworks": { "netstandard1.6": { "imports": "dnxcore50" } }
Operating system: Visual Studio version: VS 2015 Update 3 on Win10x64
Other details about my project setup: Structure:
Each BC_* project group are a DbContext and associated domain class. All are .Core class libraries.