我正在创建一个Api,同时也在使用mediatR,我已经创建了我的命令、查询和处理程序,但是当我尝试启动我的Api时,在我的程序类中出现了以下错误消息:
Could not load type 'MediatR.ServiceFactory' from assembly 'MediatR, Version=12.0.0.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2'.
我会尽力为您翻译。以下是您需要翻译的内容:
我在程序类中注册我的mediatR,代码如下:
builder.Services.AddMediatR(Assembly.GetExecutingAssembly());
我已经安装了 MediatR(最新版本:12.0.0)和 MediatR.Extensions.Microsoft.DependencyInjection(版本:11.0.0),因为目前的最新版本(11.1.0)已经被弃用。
![enter image description here](https://istack.dev59.com/Pk0zP.webp)
我正在使用 .Net 6,有什么可能的解决方案吗?谢谢提前。