The dependencies attribute in the project manifest is a JSON object that maps a package name to a version. The version number indicates which version of the package to download from the package registry. For example:
{
"dependencies": {
"com.my-package": "2.3.1",
"com.my-other-package": "1.0.1-preview.1",
etc.
}
}
In addition to using version numbers, the Package Manager also supports adding project dependencies with the following:
A direct dependency is a project-level dependency. When you install a package through the Package Manager window, or manually edit the project manifest.json
file to explicitly add a dependency, you are creating a direct package dependency ():
Packages can declare their own dependencies to other packages. Such package dependencies become indirect (), or transitive, dependencies of your project when you install the package.
The Package Manager determines which version of each package to install, no matter how it becomes a dependency of your project. To do this, it prioritizes direct dependencies over indirect dependencies, as long as the higher priority version doesn’t violate any other requirements.
This evaluation is called dependency resolution, and roughly follows this logic:
In any case, you can manually override these resolution strategies. To do this, request a specific version in the project manifest (either by installing from the Package Manager window or by editing the manifest directly). This creates a direct dependency, which takes precedence over any resolution strategy.