简体   繁体   English

.NET Standard 2.0 NuGet包生成

[英].NET Standard 2.0 NuGet Package Generation

I am working with my .NET class library project that targets Multiple .NET frameworks and now after having downloaded the .NET Core 2.0 SDK in my Windows 10 machine I am trying to target .NET Standard 2.0 as well. 我正在使用面向多个.NET框架的.NET类库项目,现在在我的Windows 10机器中下载了.NET Core 2.0 SDK后 ,我也试图以.NET Standard 2.0为目标。

<TargetFrameworks>net45;net46;netstandard1.0;netstandard1.3;netstandard2.0</TargetFrameworks>

The problem is that when the NuGet package generated by Visual Studio (2017) after compilation is opened via NuGet Package Explorer it shows that for .NET Standard 2.0 there are no dependencies. 问题是当编译后由Visual Studio(2017)生成的NuGet包通过NuGet Package Explorer打开时,它表明对于.NET Standard 2.0没有依赖性。

Screenshot1Screenshot2

Shouldn't it be having NETStandard.Library 2.0.0 as a dependency? 它应该不是NETStandard.Library 2.0.0作为依赖?

If so is it necessary (at-least till an update is released for VS) that a dependency is explicitly specified in the NuGet package for NETStandard.Library 2.0.0 ? 如果有必要(至少在VS发布更新之前),在NuSet包中为NETStandard.Library 2.0.0明确指定了依赖关系?

To be certain that it wasn't an isolated case with my project I created another project and added Newtonsoft.Json as a dependency. 为了确保它与我的项目不是一个孤立的案例,我创建了另一个项目并添加了Newtonsoft.Json作为依赖项。 The result was still the same. 结果仍然相同。

Screenshot3

The default NETStandard.Library version is still 1.6.1 when publishing for .NET Standard versions lower than 2.0. 发布低于2.0的.NET Standard版本时,默认的NETStandard.Library版本仍为1.6.1 While the 2.0.0 version is technically the same (it has the same list of dependencies for the older .NET Standard versions), you risk creating downgrade warnings for consuming projects that reference version 1.6.1 . 虽然2.0.0版本在技术上是相同的(它具有相同的旧.NET标准版本的依赖项列表),但您可能会冒险为使用引用版本1.6.1项目创建降级警告。

For .NET Standard versions 2.0 and higher, no dependency on NETStandard.Library is needed so your library will show "No Dependencies" as long as you don't add any additional NuGet packages. 对于.NET Standard 2.0及更高版本,不需要依赖NETStandard.Library ,因此只要您不添加任何其他NuGet包,您的库就会显示“No Dependencies”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Xamarin,使用.net Standard 2.0和Dependecy Services创建一个NuGet包 - Xamarin, create a NuGet Package with .net Standard 2.0 and Dependecy Services .Net Standard 2.0 生成 NuGet package 包括同一解决方案中的项目和 NuGet 包 - .Net Standard 2.0 Generate NuGet package including projects in the same solution and NuGet packages 面向.net 4.7.1的项目无法引用依赖于.net standard 2.0的NuGet程序包 - Project that targets .net 4.7.1 cannot reference a NuGet package that depends on .net standard 2.0 更新到.NET Standard 2.0 Nuget软件包 - Updating to .NET Standard 2.0 Nuget packages WinSCP NuGet软件包.NET Standard错误 - WinSCP NuGet package .NET Standard error NuGet 恢复失败 - .NET 7.0 与 .NET 标准 2.0 的兼容性 - NuGet Restore Fails - .NET 7.0 compatibility with .NET Standard 2.0 如何将 .Net Standard Nuget 包添加到 .Net 4.5 Framework 项目中? - How to add .Net Standard Nuget package into .Net 4.5 Framework Project? 在.NET Core Web API中安装自定义.NET Standard NuGet软件包 - Install custom .NET Standard NuGet Package in .NET Core Web API 如何在VS 2017中创建具有最小依赖性的.NET Standard NuGet包? - How to create .NET Standard NuGet package with minimal dependencies in VS 2017? 有什么方法可以在命令行中检查NuGet软件包是否支持.Net标准? - Is there any way to check if a NuGet package support .Net standard in command line?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM