简体   繁体   中英

Can we create a NugetPackage which can support both .NET Core (or .NET 5+) and .NET Framework?

I'm just getting started in NuGet packages creation thing and I know how to create a NuGet package for .NET Framework and .NET Core applications but I'm not sure if there any way of creating the NuGet package where it will support both .NET Core as well as .NET Framework. But I've seen the NuGet packages that works with both .NET Core and Framework.

For example, if I open.nupkg file of NewtonSoft.JSON I see the something like this.

Newtonsoft.JSON hierarchy

And yes, currently I'm developing my packages using .NET Framework 4.5, so it supports both. But I want a native support for that package not with the backwards compatibility in my .NET Core applications. Also, I don't want to develop using .NET Standard, because in Newtonsoft.JSON package it looks like they are using the .NET Standard.

.NET Standard is a specification that has multiple implementations including .NET Framework and Core/5/6.

If you want to support Framework 4.5 in addition to core the most up-to-date version you can target is Standard version 1.1.

ref: https://learn.microsoft.com/en-us/do.net/standard.net-standard?tabs.net-standard-1-1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM