Skip to content

Commit 93c5d71

Browse files
lktraserfreddydk
andauthored
#3590 Download-BcNuGetPackageToFolder select highest versions of installed … (#3850)
…apps in case of multiple occurrences in dependency tree Related to this issue: #3590 --------- Co-authored-by: Freddy Kristiansen <[email protected]>
1 parent 0eb8d7d commit 93c5d71

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

NuGet/Download-BcNuGetPackageToFolder.ps1

+6-3
Original file line numberDiff line numberDiff line change
@@ -226,21 +226,24 @@ try {
226226
$dependencyCountry = "$($matches[3])".TrimStart('.')
227227
}
228228
}
229-
$installedApp = $installedApps | Where-Object { $_ -and $_.id -and $dependencyId -like "*$($_.id)*" }
229+
$installedApp = $installedApps | Where-Object { $_ -and $_.id -and $dependencyId -like "*$($_.id)*" } | Sort-Object -Property @{ "Expression" = "[System.Version]Version" } -Descending | Select-Object -First 1
230230
if ($installedApp) {
231231
# Dependency is already installed, check version number
232232
if (!([NuGetFeed]::IsVersionIncludedInRange($installedApp.Version, $dependencyVersion))) {
233-
# The version installed ins't compatible with the NuGet package found
233+
# The version installed isn't compatible with the NuGet package found
234234
$dependenciesErr = "Dependency $dependencyId is already installed with version $($installedApp.Version), which is not compatible with the version $dependencyVersion required by the NuGet package $packageId (version $packageVersion))"
235235
}
236236
}
237237
elseif ($downloadDependencies -eq 'own') {
238-
$downloadIt = ($dependencyPublisher -eq $manifest.package.metadata.authors)
238+
$downloadIt = ($dependencyPublisher -eq [NugetFeed]::Normalize($manifest.package.metadata.authors))
239239
}
240240
elseif ($downloadDependencies -eq 'allButMicrosoft') {
241241
# Download if publisher isn't Microsoft (including if publisher is empty)
242242
$downloadIt = ($dependencyPublisher -ne 'Microsoft')
243243
}
244+
elseif ($dependencyId -match '^([^\.]+)\.([^\.]+)\.runtime\-[0-9]+\-[0-9]+\-[0-9]+\-[0-9]+$') {
245+
$downloadIt = $true
246+
}
244247
else {
245248
$downloadIt = ($downloadDependencies -ne 'none')
246249
}

0 commit comments

Comments
 (0)