将 .NetStandard 2.0 Nuget 包安装到 VS2015 Net 4.6.1 项目中 [英] Installing a .NetStandard 2.0 Nuget package into a VS2015 Net 4.6.1 project
问题描述
我正在尝试将面向 .NetStandard 2.0 (Microsoft.Extensions.Logging.Abstractions) 的 Nuget 包安装到 Visual Studio 2015 中的 Net 4.6.1 项目中.但是,虽然框架应该兼容,但它不兼容相当工作:
Install-Package:无法安装包Microsoft.Extensions.Logging.Abstractions 2.0.0".你正试图将此包安装到以.NETFramework,Version=v4.6.1"为目标的项目中,但该包不包含与该框架兼容的任何程序集引用或内容文件.如需更多信息,请联系包作者.在行:1 字符:1+ 安装包 Microsoft.Extensions.Logging.Abstractions
我已按照此处列出的步骤操作:
所以我们需要安装 .NET Core 2.0 SDK.而且每次微软关于 .NET Core 2.0 预览版的交流都提到了 Visual Studio 2017,所以我认为强烈建议使用 Visual Studio 2017 来与 .NET Core 2.0 一起工作.
此外,NuGet 包
因此将 .NetStandard 2.0 Nuget 包安装到 Net 4.6.1 项目中,我强烈建议使用 Visual Studio 2017 来处理 .NET Core 2.0.
希望这会有所帮助.
I'm trying to install a Nuget package that targets .NetStandard 2.0 (Microsoft.Extensions.Logging.Abstractions) into a Net 4.6.1 project in Visual Studio 2015. However, while Frameworks should be compatible, it doesn't quite work:
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
I've followed the steps outlined here: Entity Framework Core 2.0 on .NET 4.6.1
So I have installed package "NETStandard.Library.NETFramework", and added
<PropertyGroup>
<PackageTargetFallback>netstandard2.0</PackageTargetFallback>
</PropertyGroup>
to the csproj. But, no luck there - still the same issue.
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)?
Thanks
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)?
I am afraid not. Just like Jon pointed out that the reason for that issue is that you are using Visual Studio 2015.
According to the .NET Standard, .NET Standard 2.0 support .NET Framework 4.6.1 (with .NET Core 2.0 SDK):
So we need install .NET Core 2.0 SDK. And every communication from Microsoft about the preview of .NET Core 2.0 mentions Visual Studio 2017, so I think it's highly recommanded to use Visual Studio 2017 to work with .NET Core 2.0.
Besides, the NuGet package NETStandard.Library.NETFramework is deprecated.
So install a .NetStandard 2.0 Nuget package into a Net 4.6.1 project, I highly recommanded to use Visual Studio 2017 to work with .NET Core 2.0.
Hope this helps.
这篇关于将 .NetStandard 2.0 Nuget 包安装到 VS2015 Net 4.6.1 项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!