作者:xy278372898162 | 来源:互联网 | 2023-02-01 20:01
使用VS2017在ASP.Net Core 1.1中添加"AddSession"时出错.
'IServiceCollection'不包含'AddSession'的定义,并且没有扩展方法'AddSession'可以找到接受类型'IServiceCollection'的第一个参数(你是否缺少using指令或汇编引用?)
的.csproj
netcoreapp1.1
$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;
错误:
1> Neeraj Kumar..:
您需要包含以下Nuget包
AutoMapper.Extensions.Microsoft.Dependencyinjection
2> Lewis86..:
我知道这有点晚了,但您是否尝试从nuget安装Microsoft.AspNetCore.Session包?
https://www.nuget.org/packages/Microsoft.AspNetCore.Session/
在Visual Studio中:安装包Microsoft.AspNetCore.Session -Version 1.1.2(在我的情况下)
它对我有用!
3> RajeeshMenot..:
我通过以下方式解决了该问题。
清洁并重建解决方案。
重新启动Visual Studio 2017。
谢谢@HenkMollema