.NET Standard NuGet 跨平台兼容性
.NET Standard NuGet cross platform compatibility
我正在研究一种创建可由 .NET 4.5.1+ 和 .NET Core 1.0+ 应用程序使用的 NuGet 包的方法。我应该能够使用 .NET 标准 1.0 框架吗?如果我正在构建的这个 NuGet 解决方案依赖于 .NET Core NuGet,这会有关系吗?这有意义吗?
Should I be able to use .NET standard 1.0 framework?
多目标可能更容易;您可以在 .csproj 中使用 <TargetFrameworks>net451;netstandard1.0</TargetFrameworks>
或类似的方法;但是:.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?
.NET Core是框架,不是标准;通常,以 .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. Should I be able to use .NET standard 1.0 framework?
使用 this table 来查明特定框架是否实现了某个版本的 .NET Standard。
.Net Framework 4.5.1 最多实现 v1.2,因此您的问题的答案是 "yes" - 您可以使用 v1.0。但是,请确保 v1.0 具有足够的 API.
说到@MarcGravell 的评论
It might be easier to multi-target;
我会说 你不应该 这样做,除非你有可执行应用程序而不是共享 class 库。始终努力将 .NET Standard 用于 class 库项目。
Would it matter if this NuGet solution I am building had a dependency
on a .NET Core NuGet? Does that make sense?
一旦您以 .NET Standard 或 .NET Core 为目标,就无需添加任何其他运行时依赖项。所有这些都将被隐式添加,并将在 deps.json 文件中提及。
我正在研究一种创建可由 .NET 4.5.1+ 和 .NET Core 1.0+ 应用程序使用的 NuGet 包的方法。我应该能够使用 .NET 标准 1.0 框架吗?如果我正在构建的这个 NuGet 解决方案依赖于 .NET Core NuGet,这会有关系吗?这有意义吗?
Should I be able to use .NET standard 1.0 framework?
多目标可能更容易;您可以在 .csproj 中使用 <TargetFrameworks>net451;netstandard1.0</TargetFrameworks>
或类似的方法;但是:.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?
.NET Core是框架,不是标准;通常,以 .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. Should I be able to use .NET standard 1.0 framework?
使用 this table 来查明特定框架是否实现了某个版本的 .NET Standard。
.Net Framework 4.5.1 最多实现 v1.2,因此您的问题的答案是 "yes" - 您可以使用 v1.0。但是,请确保 v1.0 具有足够的 API.
说到@MarcGravell 的评论
It might be easier to multi-target;
我会说 你不应该 这样做,除非你有可执行应用程序而不是共享 class 库。始终努力将 .NET Standard 用于 class 库项目。
Would it matter if this NuGet solution I am building had a dependency on a .NET Core NuGet? Does that make sense?
一旦您以 .NET Standard 或 .NET Core 为目标,就无需添加任何其他运行时依赖项。所有这些都将被隐式添加,并将在 deps.json 文件中提及。