I cannot find information about what is the difference between "build" and "platform" (and maybe some other) types of dependency, and what is the default type.
As example, I can add dependency using
"Microsoft.Extensions.JsonParser.Sources": "1.0.0"
or
"Microsoft.Extensions.JsonParser.Sources": {
"type": "build",
"version": "1.0.0"
},
or
"Microsoft.Extensions.JsonParser.Sources": {
"type": "platform",
"version": "1.0.0"
},
So how to choose? Official documentation does not contain information about this yet.
I would suggest avoiding manually editing this file by hand, this way you avoid having to concern yourself with it too much. Additionally, there are plans to remove it entirely - such that you will no longer even use a project.json
file to define dependencies
. According to the JSON SchemaStore definition of the project.json
, the type
key is defined as such:
"type": {
"type": "string",
"default": "default",
"enum": [ "default", "build", "platform" ]
build = a dependency that is only required for the building of the project, build-time dependency
platform = a dependency that is expected to reside on the platform in which your project is configured to target
.
The type "platform" property on that dependency means that at publish time, the tooling will skip publishing the assemblies for that dependency to the published output.
If you examine the source for the ProjectReader.cs
in the dotnet repo you will see how it serializes this JSON to an object, and in this object we can find the meaning (detailed above).
Additional reading
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