Bog*_*gey 12 c# visual-studio nuget .net-standard
我正在尝试在Visual Studio 2015中安装一个将.NetStandard 2.0(Microsoft.Extensions.Logging.Abstractions)作为Net 4.6.1项目的Nuget软件包.但是,虽然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
Run Code Online (Sandbox Code Playgroud)
我遵循了此处概述的步骤:.NET 4.6.1上的Entity Framework Core 2.0
所以我已经安装了包"NETStandard.Library.NETFramework",并添加了
<PropertyGroup>
<PackageTargetFallback>netstandard2.0</PackageTargetFallback>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
到csproj.但是,那里没有运气 - 仍然是同样的问题.
有没有办法在我的项目中安装NetStandard 2.0软件包(没有升级VS或安装任何Net Core目标包等)?
谢谢
有没有办法在我的项目中安装NetStandard 2.0软件包(没有升级VS或安装任何Net Core目标包等)?
恐怕没有.就像Jon指出的那样,问题的原因是你正在使用Visual Studio 2015.
根据.NET标准,.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被弃用.
因此,在Net 4.6.1项目中安装.NetStandard 2.0 Nuget软件包,我强烈建议使用Visual Studio 2017与.NET Core 2.0一起使用.
希望这可以帮助.
使用以下方法支持引用.NET Standard 2.0软件包:
使用.NET Standard 2.0库时仍然存在一些缺陷,特别是在混合.NET Standard <2.0和2.0库时,这些更新提供了基本支持.
归档时间: |
|
查看次数: |
8621 次 |
最近记录: |