首页 > 解决方案 > Entity Framework Core 迁移失败并显示“无法加载文件或程序集‘System.Threading’”

问题描述

我一直在对以下开源项目进行一些更改:https ://github.com/SevenSpikes/api-plugin-for-nopcommerce

我正在尝试IdentityServer4将上述项目中引用的库从 2.0.3 更新到 2.4.0。作为此过程的一部分,我需要从以前版本到当前版本的迁移脚本。我还想获得一些生成迁移脚本的经验,因为我以前从未这样做过。

我尝试执行以下命令

> dotnet ef migrations add
> InitialIdentityServerPersistedGrantDbMigration -c
> PersistedGrantDbContext -o /Migrations/IdentityServer/PersistedGrantDb --project "C:\localpath\Nop.Plugin.Api.csproj"

基于以下文档

当我这样做时,我收到以下错误

System.IO.FileLoadException: Could not load file or assembly 'System.Threading, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at System.Console.get_IsOutputRedirected()
   at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)

我试图更新到最新版本的Core 2.2 SDK,但似乎没有帮助。

有点卡住了,希望能得到一些帮助!

标签: asp.netentity-frameworkasp.net-coreentity-framework-coreentity-framework-migrations

解决方案


推荐阅读