.net core 3.0. I have a LibraryProject(SyWaterStandardLibrary), There's a DbContext.When I build new WebProject(WebApplicationTestLibrary) and using LibraryProject.
Startup:
services.AddDbContext<LocalContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("SMS"),
optionsBuilder => optionsBuilder.MigrationsAssembly("WebApplicationTestLibrary"))
);
When I execute: add-migration init -context localcontext
An error has occurred:Your target project 'WebApplicationTestLibrary' doesn't match your migrations assembly 'SyWaterStandardLibrary'. Either change your target project or change your migrations assembly.
This exception does not exist in .net core 2.2. What's the matter, please.
Edit 1: WebApplicationTestLibrary
SyWaterStandardLibrary
When you run any Entity Framework Core command from the Package Manager Console within Visual Studio, the default project must be your migration assembly SyWaterStandardLibrary
. Here's a picture showing how to change it (here, my migration assembly is called Model
):
Note that this is not the same as the startup project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With