[英].NET Standard NuGet cross platform compatibility
I am looking into a way to create a NuGet package that can be consumed by a .NET 4.5.1+ and .NET Core 1.0+ applications. 我正在寻找一种创建可以由.NET 4.5.1+和.NET Core 1.0+应用程序使用的NuGet程序包的方法。 Should I be able to use .NET standard 1.0 framework?
我应该能够使用.NET标准1.0框架吗? Would it matter if this NuGet solution I am building had a dependency on a .NET Core NuGet?
我正在构建的此NuGet解决方案是否依赖于.NET Core NuGet会不会很重要? Does that make sense?
那有意义吗?
Should I be able to use .NET standard 1.0 framework?
我应该能够使用.NET标准1.0框架吗?
It might be easier to multi-target; 多目标可能更容易; you can use
<TargetFrameworks>net451;netstandard1.0</TargetFrameworks>
or similar to do that in the .csproj; 您可以使用
<TargetFrameworks>net451;netstandard1.0</TargetFrameworks>
或类似方法在.csproj中执行此操作; but: .NET 4.5.1 (net451) supports .NET Standard 1.2 and below, so 1.0 should be fine. 但是:.NET 4.5.1(net451)支持.NET Standard 1.2和更低版本,因此1.0应该很好。
Would it matter if this NuGet solution I am building had a dependency on a .NET Core NuGet?
我正在构建的此NuGet解决方案是否依赖于.NET Core NuGet会不会很重要?
.NET Core is a framework, not a standard; .NET Core是一个框架,而不是一个标准; normally, it is applications (exes) that target .NET Core - libraries target .NET standard.
通常,面向.NET Core的是应用程序(exes)-面向.NET标准的库。
I am looking into a way to create a NuGet package that can be consumed by a .NET 4.5.1+ and .NET Core 1.0+ applications.
我正在寻找一种创建可以由.NET 4.5.1+和.NET Core 1.0+应用程序使用的NuGet程序包的方法。 Should I be able to use .NET standard 1.0 framework?
我应该能够使用.NET标准1.0框架吗?
Use this table in order to find out if a particular framework implements some version of .NET Standard. 使用此表可以确定特定框架是否实现了某些版本的.NET Standard。
.Net Framework 4.5.1 implements up to v1.2 so the answer to your question is "yes" - you can use v1.0. .Net Framework 4.5.1最多可实现v1.2,因此您问题的答案为“是”-您可以使用v1.0。 However, make sure v1.0 has a sufficient API.
但是,请确保v1.0具有足够的API。
Speaking of @MarcGravell's comment 谈到@MarcGravell的评论
It might be easier to multi-target;
多目标可能更容易;
I would say you shouldn't do that unless you have executable applications rather than shared class library. 我要说的是除非拥有可执行的应用程序而不是共享的类库,否则不应该这样做。 Always strive to use .NET Standard for a class library project.
始终努力将.NET Standard用于类库项目。
Would it matter if this NuGet solution I am building had a dependency on a .NET Core NuGet?
我正在构建的此NuGet解决方案是否依赖于.NET Core NuGet会不会很重要? Does that make sense?
那有意义吗?
There's no need to add any other runtime dependencies once you target .NET Standard or .NET Core. 一旦以.NET Standard或.NET Core为目标,就无需添加任何其他运行时依赖项。 All of those will be added implicitly and will be mentioned within deps.json file.
所有这些都将隐式添加,并将在deps.json文件中提及。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.