Reputation: 38437
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?
Upvotes: 14
Views: 8404
Reputation: 5240
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.
Upvotes: 17