加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 将.NetStandard 2.0 Nuget软件包安装到VS2015 Net 4.6.1项

发布时间:2020-12-15 07:59:15 所属栏目:百科 来源:网络整理
导读:我正在尝试将.NetStandard 2.0(Microsoft.Extensions.Logging.Abstractions)的Nuget包安装到Visual Studio 2015中的Net 4.6.1项目中.但是,虽然Frameworks应该是兼容的,但它并不完全有效: Install-Package : Could not install package 'Microsoft.Extension
我正在尝试将.NetStandard 2.0(Microsoft.Extensions.Logging.Abstractions)的Nuget包安装到Visual Studio 2015中的Net 4.6.1项目中.但是,虽然Frameworks应该是兼容的,但它并不完全有效:
Install-Package : Could not install package 'Microsoft.Extensions.Logging.Abstractions 2.0.0'. You are trying to 
install this package into a project that targets '.NETFramework,Version=v4.6.1',but the package does not contain 
any assembly references or content files that are compatible with that framework. For more information,contact 
the package author.
At line:1 char:1
+ Install-Package Microsoft.Extensions.Logging.Abstractions

我按照这里列出的步骤进行了操作:Entity Framework Core 2.0 on .NET 4.6.1

所以我已经安装了包“NETStandard.Library.NETFramework”,并添加了

<PropertyGroup>
  <PackageTargetFallback>netstandard2.0</PackageTargetFallback>
</PropertyGroup>

到csproj.但是,那里没有运气 – 仍然是同样的问题.

有没有办法在我的项目中安装NetStandard 2.0软件包(没有升级VS或安装任何Net Core目标包等)?

谢谢

解决方法

Is there any way to install a NetStandard 2.0 package into my project (without upgrading VS or installing any Net Core targeting packs or such)?

恐怕没有.就像Jon指出的那样,问题的原因是你正在使用Visual Studio 2015.

根据.NET Standard,.NET Standard 2.0支持.NET Framework 4.6.1(带.NET Core 2.0 SDK):

所以我们需要安装.NET Core 2.0 SDK.微软关于.NET Core 2.0预览的每次通信都提到了Visual Studio 2017,所以我认为强烈建议使用Visual Studio 2017来使用.NET Core 2.0.

此外,不推荐使用NuGet软件包NETStandard.Library.NETFramework.

因此,将.NetStandard 2.0 Nuget软件包安装到Net 4.6.1项目中,我强烈建议使用Visual Studio 2017与.NET Core 2.0一起使用.

希望这可以帮助.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读