小编jia*_*756的帖子

您的目标项目“x”与您的迁移程序集“xx”不匹配。更改您的目标项目或更改您的迁移程序集

.net 核心 3.0。我有一个 LibraryProject(SyWaterStandardLibrary),有一个 DbContext。当我构建新的 WebProject(WebApplicationTestLibrary) 并使用 LibraryProject 时。

启动:

  services.AddDbContext<LocalContext>(options =>
                options.UseSqlServer(Configuration.GetConnectionString("SMS"), 
                optionsBuilder => optionsBuilder.MigrationsAssembly("WebApplicationTestLibrary"))
               );
Run Code Online (Sandbox Code Playgroud)

当我执行: add-migration init -context localcontext

发生错误:您的目标项目“WebApplicationTestLibrary”与您的迁移程序集“SyWaterStandardLibrary”不匹配。更改您的目标项目或更改您的迁移程序集。

.net core 2.2 中不存在此异常。请问怎么回事。

编辑 1: WebApplicationTestLibrary

SyWater标准库

c# entity-framework-core asp.net-core

6
推荐指数
1
解决办法
6524
查看次数

标签 统计

asp.net-core ×1

c# ×1

entity-framework-core ×1