You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Consume-Packages/Dependency-Resolution.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -87,15 +87,15 @@ NuGet 3.x restores the lowest possible version of a package as defined by its de
87
87
88
88
For example, in the following figure *1.0-Beta* is considered lower than *1.0* so NuGet chooses the 1.0 version:
89
89
90
-

90
+

91
91
92
92
In the next figure, version *2.1* is not available on the feed but because the version constraint is *>= 2.1* NuGet will pick the next lowest version it can find, in this case *2.2*:
93
93
94
-

94
+

95
95
96
96
When an application specifies an exact version number, such as *1.2*, that is not available on the feed, NuGet will fail with an error when attempting to install or restore the package:
97
97
98
-

98
+

99
99
100
100
<aname="floating-versions"></a>
101
101
@@ -105,7 +105,7 @@ A floating dependency version is specified with the * wildcard, as with *6.0.\**
105
105
106
106
When a floating version constraint is specified then NuGet will resolve the highest version of a package that matches the version pattern, for example *6.0.** will get the highest version of a package that starts with *6.0*:
107
107
108
-

108
+

109
109
110
110
<aname="nearest-wins"></a>
111
111
@@ -115,25 +115,25 @@ When the package graph for an application contains different versions of the sam
115
115
116
116
In the example below, the application depends directly on Package B with a version constraint of *>=2.0*. The application also depends on Package A which in turn also depends on Package B, but with a *>=1.0* constraint. Because the dependency on Package B *2.0* is nearer to the application in the graph, that version is used:
117
117
118
-

118
+

119
119
120
120
>[!Warning]
121
121
> Applying the Nearest Wins rule can downgrading the package version, thus potentially breaking other dependencies in the graph. This currently produces an error, although we are considering making it a warning instead. See [issue #897 on GitHub](https://github.com/NuGet/Home/issues/897).
122
122
123
123
This rule also results in greater efficiency with large dependency graph (such as those with the BCL packages) because by once a given dependency is ignored, NuGet also ignores all remaining dependencies on that branch of the graph. In the diagram below, for example, because Package C 2.0 will be used, NuGet can ignore any branches in the graph that refer to an older version of Package C:
124
124
125
-

125
+

126
126
127
127
<aname="cousin-dependencies"></a>
128
128
129
129
#### Cousin dependencies
130
130
131
131
When different package versions are referred to at the same distance in the graph from the application, NuGet uses the lowest version that satisfies all version requirements (as with the [lowest applicable version](#lowest-applicable-version) and [floating versions](#floating-versions) rules). In the image below, for example, version *2.0* of Package B will satisfy the other *>=1.0* constraint, and will thus be used:
132
132
133
-

133
+

134
134
135
135
In some cases, it is not possible to meet all version requirements. As shown below, if Package A required exactly Package B *1.0* and Package C requires Package B *>=2.0*, then NuGet cannot resolve the dependencies and will give an error.
136
136
137
-

137
+

138
138
139
139
In these situations, the top-level consumer (the application or package) should add its own direct dependency on Package B so that the [Nearest Wins](#nearest-wins) rule applies.
0 commit comments