将.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项目中。但是,尽管Frameworks应该兼容,但它不兼容相当有效:
Install-Package:无法安装软件包 Microsoft.Extensions.Logging.Abstractions 2.0.0。您正在尝试
将此软件包安装到以 .NETFramework,Version = v4.6.1为目标的项目中,但该软件包不包含
与该框架兼容的任何程序集引用或内容文件。有关更多信息,请与软件包作者
联系。
在第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屋!