use*_*264 3 automapper .net-core
在我的 nugent 面板中,我安装了
AutoMapper v7.0.1 AutoMapper.extensions.microsoft.dependencyinjection v5.0.1
在我的 Startup.cs 中,
我添加了
Services.AddAutoMapper();
但编译器给出
Severity Code Description Project File Line Suppression State
Error CS1061 'IServiceCollection' does not contain a definition for 'AddAutoMapper' and no accessible extension method 'AddAutoMapper' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?) OPEApiService J:\Projects\OPEApiService\OPEApiService\Startup.cs 58 Active
Run Code Online (Sandbox Code Playgroud)
我尝试清理、重建、关闭并重新打开 VS。
任何帮助表示赞赏。
谢谢
小智 8
这可能是两个包之间的兼容性问题。如果您同时安装了 AutoMapper 和 AutoMapper.extensions.microsoft.dependencyinjection 包,请将其删除并仅添加 AutoMapper.extensions.microsoft.dependencyinjection。它依赖于 AutoMapper 包。
我遇到了同样的问题并且能够解决它。
| 归档时间: |
|
| 查看次数: |
5512 次 |
| 最近记录: |