In a new ASP.NET Core RC2 class library, I have the following project.json file, where I have tried to follow the docs on How to trim your package dependencies.
{
"dependencies": {
"Microsoft.AspNetCore.Mvc.Abstractions": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc.Core": "1.0.0-rc2-final",
"Microsoft.Extensions.Caching.Abstractions": "1.0.0-rc2-final",
"Newtonsoft.Json": "8.0.3"
},
"frameworks": {
"netstandard1.5": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1-rc2-24027",
"Microsoft.NETCore.Runtime": "1.0.2-rc2-24027",
"System.Xml.XDocument": "4.0.11-rc2-24027"
},
"imports": "dnxcore50"
},
"net461": {
"frameworkAssemblies": {
"System.ServiceModel": "",
"System.Xml": "",
"System.Xml.Linq": ""
}
}
}
}
When I have tried removing Microsoft.NETCore.Platforms
and Microsoft.NETCore.Runtime
, everything still works. This is probably because the Microsoft dependencies also specify these. What are these dependencies for and should I be explicit and keep them?
NET Core vs ASP.NET Core. . NET Core is a runtime to execute applications build on it. ASP.NET Core is a web framework to build web apps, IoT apps, and mobile backends on the top of .
NET Core. In this case, the best . NET version to target for the migration is . NET 6, which is the most recent LTS version.
The .NET Desktop Runtime enables you to run existing Windows desktop applications. This release includes the .NET Runtime; you don't need to install it separately.
NET Core installations are completely independent from the version of . NET Framework. In fact, you can actually install multiple version of . NET Core side-by-side on the same machine (unlike .
What purpose do the packages have:
Microsoft.NETCore.Platforms
is essentially only a json files which specifies the runtime identifiers (RIDs). These Ids (e.g. osx.10.10-x64
or win7-x86
) are used when platform specific code needs to be deployed (e.g. a special compiled CoreCLR or platform specific compression or crypto library). It forms a kind of tree which allows more generic platform patterns (like linux
which is later the parent for e.g. rhel
which again is the parent for a specific supported version rhel-7.1-x64
). So When someone builds a NuGet, you can add an artifiact like an assembly which is deployed on all linux machines (e.g. doing P/Invoke against the standard linux apis) or a specific linux distribution (e.g. using a special RedHat feature).
Microsoft.NETCore.Runtime
is a trickier story. It is used to lookup the right runtime for your platform.
Should you keep them: Since you do not use them directly, adding these dependencies explicitly does not bring any benefit to my understanding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With