Two new parameters on Sort-AppFilesByDependencies
(includeSystemDependencies and includeDependencyVersion)
Add Public Microsoft NuGet Feeds as settings constants
Fix issues in Download-BcNuGetPackageToFolder, where extensive amounts
of NuGet searches was performed to locate packages
Download-BcNuGetPackageToFolder now returns an array of apps downloaded
instead of True/False

---------

Co-authored-by: freddydk <freddydk@users.noreply.github.com>
This commit is contained in:
Freddy Kristiansen 2024-02-14 10:56:25 +01:00 коммит произвёл GitHub
Родитель b0e2bbe78d
Коммит 2bc6df4f25
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
6 изменённых файлов: 161 добавлений и 81 удалений

Просмотреть файл

@ -9,6 +9,12 @@
Array of AppIds. If specified, then include Only Apps in the specified AppFile array or archive which is contained in this Array and their dependencies
.Parameter unknownDependencies
If specified, this reference parameter will contain unresolved dependencies after sorting
.Parameter excludeRuntimePackages
If specified, runtime packages will be ignored
.Parameter includeSystemDependencies
If specified, dependencies on Microsoft.Application and Microsoft.Platform will be included
.Parameter includeDependencyVersion
If specified, the version of the dependencies will be included in the output
.Example
$files = Sort-AppFilesByDependencies -appFiles @($app1, $app2)
#>
@ -22,7 +28,9 @@ function Sort-AppFilesByDependencies {
$excludeInstalledApps = @(),
[Parameter(Mandatory=$false)]
[ref] $unknownDependencies,
[switch] $excludeRuntimePackages
[switch] $excludeRuntimePackages,
[switch] $includeSystemDependencies,
[switch] $includeDependencyVersion
)
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
@ -109,6 +117,24 @@ function Sort-AppFilesByDependencies {
$anApp.Dependencies | ForEach-Object { AddDependency -Dependency $_ }
}
}
if ($includeSystemDependencies.IsPresent) {
if ($anApp.psobject.Members | Where-Object name -eq "application") {
AddDependency -dependency ([PSCustomObject]@{
"publisher" = "Microsoft"
"name" = "Application"
"version" = $anApp.Application
"id" = 'Microsoft.Application'
})
}
if ($anApp.psobject.Members | Where-Object name -eq "platform") {
AddDependency -dependency ([PSCustomObject]@{
"publisher" = "Microsoft"
"name" = "Platform"
"version" = $anApp.Platform
"id" = 'Microsoft.Platform'
})
}
}
}
}
@ -163,7 +189,7 @@ function Sort-AppFilesByDependencies {
}
if ($unknownDependencies) {
$unknownDependencies.value = @($script:unresolvedDependencies | ForEach-Object { if ($_) {
"$(if ($_.PSObject.Properties.name -eq 'AppId') { $_.AppId } else { $_.Id }):" + $("$($_.publisher)_$($_.name)_$($_.version).app".Split([System.IO.Path]::GetInvalidFileNameChars()) -join '')
"$(if ($_.PSObject.Properties.name -eq 'AppId') { $_.AppId } else { $_.Id }):$(if($includeDependencyVersion.IsPresent){"$($_.Version):"})" + $("$($_.publisher)_$($_.name)_$($_.version).app".Split([System.IO.Path]::GetInvalidFileNameChars()) -join '')
} })
}
}

Просмотреть файл

@ -112,6 +112,8 @@ function Get-ContainerHelperConfig {
"OAuthHostName" = "b52e8b6a-2953-4a08-8e28-5cf45a2dffdc"
"OAuthScopes" = "api://b52e8b6a-2953-4a08-8e28-5cf45a2dffdc/.default offline_access"
}
"MSSymbolsNuGetFeedUrl" = 'https://dynamicssmb2.pkgs.visualstudio.com/DynamicsBCPublicFeeds/_packaging/MSSymbols/nuget/v3/index.json'
"MSAppsNuGetFeedUrl" = 'https://dynamicssmb2.pkgs.visualstudio.com/DynamicsBCPublicFeeds/_packaging/MSApps/nuget/v3/index.json'
"TrustedNuGetFeeds" = @(
)
}

Просмотреть файл

@ -72,18 +72,67 @@ Function Download-BcNuGetPackageToFolder {
[PSCustomObject[]] $installedApps = @(),
[ValidateSet('all','own','allButMicrosoft','allButApplication','allButPlatform','none')]
[string] $downloadDependencies = 'allButApplication',
[switch] $allowPrerelease
[switch] $allowPrerelease,
[switch] $checkLocalVersion
)
try {
$returnValue = $false
$findSelect = $select
if ($select -eq 'LatestMatching') {
$findSelect = 'Latest'
}
$excludeVersions = @()
if ($checkLocalVersion) {
# Format Publisher.Name[.Country][.symbols][.AppId]
if ($packageName -match '^(Microsoft)\.([^\.]+)(\.[^\.][^\.])?(\.symbols)?(\.[0-9A-Fa-f]{8}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{12})?$') {
$publisher = $matches[1]
$name = $matches[2]
$countryPart = "$($matches[3])"
$symbolsPart = "$($matches[4])"
$appIdPart = "$($matches[5])"
$checkPackageName = ''
if ($name -ne 'Platform' -and $countryPart -eq '' -and $installedCountry -ne '') {
$countryPart = ".$installedCountry"
$checkPackageName = "$publisher.$name$countryPart$symbolsPart$appIdPart"
}
if ($checkPackageName -and $checkPackageName -ne $packageName) {
$downloadedPackages = Download-BcNuGetPackageToFolder -nuGetServerUrl $nuGetServerUrl -nuGetToken $nuGetToken -packageName $checkPackageName -version $version -folder $folder -copyInstalledAppsToFolder $copyInstalledAppsToFolder -installedPlatform $installedPlatform -installedCountry $installedCountry -installedApps $installedApps -downloadDependencies $downloadDependencies -verbose:($VerbosePreference -eq 'Continue') -select $select -allowPrerelease:$allowPrerelease
if ($downloadedPackages) {
return $downloadedPackages
}
}
return Download-BcNuGetPackageToFolder -nuGetServerUrl $nuGetServerUrl -nuGetToken $nuGetToken -packageName $packageName -version $version -folder $folder -copyInstalledAppsToFolder $copyInstalledAppsToFolder -installedPlatform $installedPlatform -installedCountry $installedCountry -installedApps $installedApps -downloadDependencies $downloadDependencies -verbose:($VerbosePreference -eq 'Continue') -select $select -allowPrerelease:$allowPrerelease
}
}
Write-Host "Looking for NuGet package $packageName version $version ($select match)"
if ($packageName -match '^Microsoft\.Platform(\.symbols)?$') {
if ($installedPlatform) {
$existingPlatform = $installedPlatform
}
else {
$existingPlatform = $installedApps | Where-Object { $_ -and $_.Name -eq 'Platform' } | Select-Object -ExpandProperty Version
}
if ($existingPlatform -and ([NuGetFeed]::IsVersionIncludedInRange($existingPlatform, $version))) {
Write-Host "Microsoft.Platform version $existingPlatform is already available"
return @()
}
}
elseif ($packageName -match '^([^\.]+\.)?Application(\.[^\.]+)?(\.symbols)?$') {
$installedApp = $installedApps | Where-Object { $_ -and $_.Name -eq 'Application' }
if ($installedApp -and ([NuGetFeed]::IsVersionIncludedInRange($installedApp.Version, $version))) {
Write-Host "Application version $($installedApp.Version) is already available"
return @()
}
}
elseif ($packageName -match '^([^\.]+)\.([^\.]+)(\.[^\.][^\.])?(\.symbols)?(\.[0-9A-Fa-f]{8}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{12})?$') {
$installedApp = $installedApps | Where-Object { $_ -and $_.id -and $packageName -like "*$($_.id)*" }
if ($installedApp -and ([NuGetFeed]::IsVersionIncludedInRange($installedApp.Version, $version))) {
Write-Host "$($installedApp.Name) from $($installedApp.publisher) version $($installedApp.Version) is already available (AppId=$($installedApp.id))"
return @()
}
}
while ($true) {
$returnValue = @()
$feed, $packageId, $packageVersion = Find-BcNugetPackage -nuGetServerUrl $nuGetServerUrl -nuGetToken $nuGetToken -packageName $packageName -version $version -excludeVersions $excludeVersions -verbose:($VerbosePreference -eq 'Continue') -select $findSelect -allowPrerelease:($allowPrerelease.IsPresent)
if (-not $feed) {
Write-Host "No package found matching package name $($packageName) Version $($version)"
@ -96,6 +145,22 @@ try {
Write-Verbose "NUSPEC:"
$nuspec | ForEach-Object { Write-Verbose $_ }
$manifest = [xml]$nuspec
$appId = ''
$appName = $manifest.package.metadata.title
if ($manifest.package.metadata.id -match '^.*([0-9A-Fa-f]{8}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{12})$') {
# If packageId ends in a GUID (AppID) then use the AppId for the packageId
$appId = "$($matches[1])"
}
elseif ($manifest.package.metadata.id -like 'Microsoft.Platform*') {
# If packageId starts with Microsoft.Platform then use the packageId for the packageId
$appName = 'Platform'
}
$returnValue = @([PSCustomObject]@{
"Publisher" = $manifest.package.metadata.authors
"Name" = $appName
"id" = $appId
"Version" = $manifest.package.metadata.version
})
$dependenciesErr = ''
if ($manifest.package.metadata.PSObject.Properties.Name -eq 'Dependencies') {
$dependencies = $manifest.package.metadata.Dependencies.GetEnumerator()
@ -104,11 +169,14 @@ try {
$dependencies = @()
}
foreach($dependency in $dependencies) {
if (-not $installedPlatform) {
$installedPlatform = $installedApps+$returnValue | Where-Object { $_ -and $_.Name -eq 'Platform' } | Select-Object -ExpandProperty Version
}
$dependencyVersion = $dependency.Version
$dependencyId = $dependency.Id
$dependencyCountry = ''
$downloadIt = $false
if ($dependencyId -eq 'Microsoft.Platform') {
if ($dependencyId -match '^Microsoft\.Platform(\.symbols)?$') {
$dependencyPublisher = 'Microsoft'
# Dependency is to the platform
if ($installedPlatform) {
@ -116,26 +184,22 @@ try {
# The NuGet package found isn't compatible with the installed platform
$dependenciesErr = "NuGet package $packageId (version $packageVersion) requires platform $dependencyVersion. You cannot install it on version $installedPlatform"
}
$downloadIt = $false
}
else {
$downloadIt = ($downloadDependencies -eq 'all')
}
}
elseif ($dependencyId -match '^([^\.]+\.)?Application(\.[^\.]+)?$') {
elseif ($dependencyId -match '^([^\.]+\.)?Application(\.[^\.]+)?(\.symbols)?$') {
# Dependency is to the application
$dependencyPublisher = $matches[1].TrimEnd('.')
if ($matches.Count -gt 2) {
$dependencyCountry = $matches[2].TrimStart('.')
}
if ($installedCountry -and $dependencyCountry -and ($installedCountry -ne $dependencyCountry)) {
# The NuGet package found isn't compatible with the installed application
Write-Host "WARNING: NuGet package $packageId (version $packageVersion) requires $dependencyCountry application. You have $installedCountry application installed"
}
$dependencyCountry = "$($matches[2])".TrimStart('.')
$installedApp = $installedApps | Where-Object { $_ -and $_.Name -eq 'Application' }
if ($installedApp) {
if (!([NuGetFeed]::IsVersionIncludedInRange($installedApp.Version, $dependencyVersion))) {
$dependenciesErr = "NuGet package $packageId (version $packageVersion) requires application $dependencyVersion. You cannot install it on version $($installedApp.Version)"
}
$downloadIt = $false
}
else {
$downloadIt = ($downloadDependencies -eq 'all' -or $downloadDependencies -eq 'allButPlatform')
@ -143,11 +207,11 @@ try {
}
else {
$dependencyPublisher = ''
if ($dependencyId -match '^([^\.]+)\.([^\.]+)\.([^\.]+\.)?([0-9A-Fa-f]{8}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{12})$') {
# Matches publisher.name.[country.].appId format (country section is only for microsoft apps)
if ($dependencyId -match '^([^\.]+)\.([^\.]+)(\.[^\.][^\.])?(\.symbols)?(\.[0-9A-Fa-f]{8}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{12})?$') {
# Matches publisher.name[.country][.symbols][.appId] format (country section is only for microsoft apps)
$dependencyPublisher = $matches[1]
if ($dependencyPublisher -eq 'microsoft' -and $matches.Count -gt 3) {
$dependencyCountry = $matches[3].TrimEnd('.')
if ($dependencyPublisher -eq 'microsoft') {
$dependencyCountry = "$($matches[3])".TrimStart('.')
}
}
$installedApp = $installedApps | Where-Object { $_ -and $_.id -and $dependencyId -like "*$($_.id)*" }
@ -169,6 +233,10 @@ try {
$downloadIt = ($downloadDependencies -ne 'none')
}
}
if ($installedCountry -and $dependencyCountry -and ($installedCountry -ne $dependencyCountry)) {
# The NuGet package found isn't compatible with the installed application
Write-Host "WARNING: NuGet package $packageId (version $packageVersion) requires $dependencyCountry application. You have $installedCountry application installed"
}
if ($dependenciesErr) {
if ($select -ne 'LatestMatching') {
throw $dependenciesErr
@ -180,36 +248,7 @@ try {
}
}
if ($downloadIt) {
$checkPackageName = ''
if ($dependencyId -match '^.*([0-9A-Fa-f]{8}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{4}\-[0-9A-Fa-f]{12})$') {
# If dependencyId ends in a GUID (AppID) then use the AppId for downloading dependencies
$dependencyId = $matches[1]
if ($dependencyCountry) {
# Dependency is to a specific country version - must find the country version of the dependency
$dependencyId = "$dependencyCountry.$dependencyId"
}
elseif ($installedCountry -and $dependencyPublisher -eq 'Microsoft') {
# Looking for a Microsoft package - check if it exists for the installed country (revert to appId if not)
$checkPackageName = "$installedCountry.$dependencyId"
}
}
elseif (($dependencyId -match '^Microsoft.Application(\.[^\.]+)?$') -and ($matches.Count -eq 1)) {
# If dependency is to the Application without a specific country, then check if a localization version of the application exists for the installed country
$checkPackageName = "Microsoft.Application.$installedCountry"
}
if ($checkPackageName) {
Write-Host -ForegroundColor Yellow $checkPackageName
if (Download-BcNuGetPackageToFolder -nuGetServerUrl $nuGetServerUrl -nuGetToken $nuGetToken -packageName $checkPackageName -version $dependencyVersion -folder $package -copyInstalledAppsToFolder $copyInstalledAppsToFolder -installedPlatform $installedPlatform -installedCountry $installedCountry -installedApps $installedApps -downloadDependencies $downloadDependencies -verbose:($VerbosePreference -eq 'Continue') -select $select -allowPrerelease:$allowPrerelease) {
$returnValue = $true
$downloadIt = $false
}
}
if ($downloadIt) {
Write-Host -ForegroundColor Yellow $dependencyId
if (Download-BcNuGetPackageToFolder -nuGetServerUrl $nuGetServerUrl -nuGetToken $nuGetToken -packageName $dependencyId -version $dependencyVersion -folder $package -copyInstalledAppsToFolder $copyInstalledAppsToFolder -installedPlatform $installedPlatform -installedCountry $installedCountry -installedApps $installedApps -downloadDependencies $downloadDependencies -verbose:($VerbosePreference -eq 'Continue') -select $select -allowPrerelease:$allowPrerelease) {
$returnValue = $true
}
}
$returnValue += Download-BcNuGetPackageToFolder -nuGetServerUrl $nuGetServerUrl -nuGetToken $nuGetToken -packageName $dependencyId -version $dependencyVersion -folder $package -copyInstalledAppsToFolder $copyInstalledAppsToFolder -installedPlatform $installedPlatform -installedCountry $installedCountry -installedApps @($installedApps+$returnValue) -downloadDependencies $downloadDependencies -verbose:($VerbosePreference -eq 'Continue') -select $select -allowPrerelease:$allowPrerelease -checkLocalVersion
}
}
if ($dependenciesErr) {
@ -230,7 +269,6 @@ try {
$appFiles = Get-Item -Path (Join-Path $package "*.app")
}
foreach($appFile in $appFiles) {
$returnValue = $true
Copy-Item $appFile.FullName -Destination $folder -Force
if ($copyInstalledAppsToFolder) {
Copy-Item $appFile.FullName -Destination $copyInstalledAppsToFolder -Force

Просмотреть файл

@ -60,11 +60,12 @@ Function Find-BcNuGetPackage {
if (!($feed.PSObject.Properties.Name -eq 'Patterns')) { $feed | Add-Member -MemberType NoteProperty -Name 'Patterns' -Value @('*') }
if (!($feed.PSObject.Properties.Name -eq 'Fingerprints')) { $feed | Add-Member -MemberType NoteProperty -Name 'Fingerprints' -Value @() }
$nuGetFeed = [NuGetFeed]::Create($feed.Url, $feed.Token, $feed.Patterns, $feed.Fingerprints)
$packageIds = $nuGetFeed.Search($packageName)
if ($packageIds) {
foreach($packageId in $packageIds) {
$packages = $nuGetFeed.Search($packageName)
if ($packages) {
foreach($package in $packages) {
$packageId = $package.Id
Write-Host "PackageId: $packageId"
$packageVersion = $nuGetFeed.FindPackageVersion($packageId, $version, $excludeVersions, $select, $allowPrerelease.IsPresent)
$packageVersion = $nuGetFeed.FindPackageVersion($package, $version, $excludeVersions, $select, $allowPrerelease.IsPresent)
if (!$packageVersion) {
Write-Host "No package found matching version '$version' for package id $($packageId)"
continue

Просмотреть файл

@ -80,7 +80,7 @@ class NuGetFeed {
return ($packageId -and ($this.patterns | Where-Object { $packageId -like $_ }))
}
[string[]] Search([string] $packageName) {
[hashtable[]] Search([string] $packageName) {
if ($this.searchQueryServiceUrl -match '^https://nuget.pkg.github.com/(.*)/query$') {
# GitHub support for SearchQueryService is unstable and is not usable
# use GitHub API instead
@ -97,21 +97,21 @@ class NuGetFeed {
}
$queryUrl = "https://api.github.com/orgs/$organization/packages?package_type=nuget&per_page=100&page="
$page = 1
Write-Host "Search package using $queryUrl$page"
Write-Host -ForegroundColor Yellow "Search package using $queryUrl$page"
$matching = @()
while ($true) {
$result = Invoke-RestMethod -Method GET -Headers $headers -Uri "$queryUrl$page"
if ($result.Count -eq 0) {
break
}
$matching += @($result | Where-Object { $_.name -like "*$packageName*" -and $this.IsTrusted($_.name) } | ForEach-Object { $_.name })
$matching += @($result | Where-Object { $_.name -like "*$packageName*" -and $this.IsTrusted($_.name) } | Sort-Object { $_.name.replace('.symbols','') } | ForEach-Object { @{ "id" = $_.name; "versions" = @() } } )
$page++
}
}
else {
$queryUrl = "$($this.searchQueryServiceUrl)?q=$packageName"
$queryUrl = "$($this.searchQueryServiceUrl)?q=$packageName&take=50"
try {
Write-Host "Search package using $queryUrl"
Write-Host -ForegroundColor Yellow "Search package using $queryUrl"
$prev = $global:ProgressPreference; $global:ProgressPreference = "SilentlyContinue"
$searchResult = Invoke-RestMethod -UseBasicParsing -Method GET -Headers ($this.GetHeaders()) -Uri $queryUrl
$global:ProgressPreference = $prev
@ -120,28 +120,42 @@ class NuGetFeed {
throw (GetExtendedErrorMessage $_)
}
# Check that the found pattern matches the package name and the trusted patterns
$matching = @($searchResult.data | Where-Object { $_.id -like "*$($packageName)*" -and $this.IsTrusted($_.id) } | ForEach-Object { $_.id })
$matching = @($searchResult.data | Where-Object { $_.id -like "*$($packageName)*" -and $this.IsTrusted($_.id) } | Sort-Object { $_.id.replace('.symbols','') } | ForEach-Object { @{ "id" = $_.id; "versions" = @($_.versions.version) } } )
}
Write-Host "$($matching.count) matching packages found"
return $matching | ForEach-Object { Write-Host "- $_"; $_ }
$exact = $matching | Where-Object { $_.id -eq $packageName -or $_.id -eq "$packageName.symbols" }
if ($exact) {
Write-Host "Exact match found for $packageName"
$matching = $exact
}
else {
Write-Host "$($matching.count) matching packages found"
}
return $matching | ForEach-Object { Write-Host "- $($_.id)"; $_ }
}
[string[]] GetVersions([string] $packageId, [bool] $descending, [bool] $allowPrerelease) {
if (!$this.IsTrusted($packageId)) {
throw "Package $packageId is not trusted on $($this.url)"
[string[]] GetVersions([hashtable] $package, [bool] $descending, [bool] $allowPrerelease) {
if (!$this.IsTrusted($package.id)) {
throw "Package $($package.id) is not trusted on $($this.url)"
}
$queryUrl = "$($this.packageBaseAddressUrl.TrimEnd('/'))/$($packageId.ToLowerInvariant())/index.json"
try {
Write-Host "Get versions using $queryUrl"
$prev = $global:ProgressPreference; $global:ProgressPreference = "SilentlyContinue"
$versions = Invoke-RestMethod -UseBasicParsing -Method GET -Headers ($this.GetHeaders()) -Uri $queryUrl
$global:ProgressPreference = $prev
if ($package.versions.count -ne 0) {
$versionsArr = $package.versions
}
catch {
throw (GetExtendedErrorMessage $_)
else {
$queryUrl = "$($this.packageBaseAddressUrl.TrimEnd('/'))/$($package.Id.ToLowerInvariant())/index.json"
try {
Write-Host -ForegroundColor Yellow "Get versions using $queryUrl"
$prev = $global:ProgressPreference; $global:ProgressPreference = "SilentlyContinue"
$versions = Invoke-RestMethod -UseBasicParsing -Method GET -Headers ($this.GetHeaders()) -Uri $queryUrl
$global:ProgressPreference = $prev
}
catch {
throw (GetExtendedErrorMessage $_)
}
$versionsArr = @($versions.versions)
}
Write-Host "$($versions.versions.count) versions found"
$versionsArr = @($versions.versions | Where-Object { $allowPrerelease -or !$_.Contains('-') } | Sort-Object { ($_ -replace '-.+$') -as [System.Version] }, { "$($_)z" } -Descending:$descending | ForEach-Object { "$_" })
Write-Host "$($versionsArr.count) versions found"
$versionsArr = @($versionsArr | Where-Object { $allowPrerelease -or !$_.Contains('-') } | Sort-Object { ($_ -replace '-.+$') -as [System.Version] }, { "$($_)z" } -Descending:$descending | ForEach-Object { "$_" })
Write-Host "First version is $($versionsArr[0])"
Write-Host "Last version is $($versionsArr[$versionsArr.Count-1])"
return $versionsArr
@ -240,8 +254,8 @@ class NuGetFeed {
return $false
}
[string] FindPackageVersion([string] $packageId, [string] $nuGetVersionRange, [string[]] $excludeVersions, [string] $select, [bool] $allowPrerelease) {
$versions = $this.GetVersions($packageId, ($select -ne 'Earliest'), $allowPrerelease)
[string] FindPackageVersion([hashtable] $package, [string] $nuGetVersionRange, [string[]] $excludeVersions, [string] $select, [bool] $allowPrerelease) {
$versions = $this.GetVersions($package, ($select -ne 'Earliest'), $allowPrerelease)
if ($excludeVersions) {
Write-Host "Exclude versions: $($excludeVersions -join ', ')"
}
@ -262,11 +276,6 @@ class NuGetFeed {
return ''
}
[string] DownloadPackage([string] $packageId) {
$version = $this.GetVersions($packageId,$true,$false)[0]
return $this.DownloadPackage($packageId, $version)
}
[xml] DownloadNuSpec([string] $packageId, [string] $version) {
if (!$this.IsTrusted($packageId)) {
throw "Package $packageId is not trusted on $($this.url)"
@ -294,7 +303,7 @@ class NuGetFeed {
$queryUrl = "$($this.packageBaseAddressUrl.TrimEnd('/'))/$($packageId.ToLowerInvariant())/$($version.ToLowerInvariant())/$($packageId.ToLowerInvariant()).$($version.ToLowerInvariant()).nupkg"
$tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([GUID]::NewGuid().ToString())
try {
Write-Host "Download package using $queryUrl"
Write-Host -ForegroundColor Green "Download package using $queryUrl"
$prev = $global:ProgressPreference; $global:ProgressPreference = "SilentlyContinue"
$filename = "$tmpFolder.zip"
Invoke-RestMethod -UseBasicParsing -Method GET -Headers ($this.GetHeaders()) -Uri $queryUrl -OutFile $filename

Просмотреть файл

@ -3,6 +3,10 @@ Include Microsoft_Business Foundation Test Libraries.app when importing test lib
Include Microsoft_System Application Test.app and Microsoft_Business Foundation Tests.app when importing tests
Bug when running Publish-BcContainerApp against a cloud container ($authContext not defined)
Remove the need for a Container when using Replace-DependenciesInAppFile (containername parameter is now obsolete)
Two new parameters on Sort-AppFilesByDependencies (includeSystemDependencies and includeDependencyVersion)
Add Public Microsoft NuGet Feeds as settings constants
Fix issues in Download-BcNuGetPackageToFolder, where extensive amounts of NuGet searches was performed to locate packages
Download-BcNuGetPackageToFolder now returns an array of apps downloaded instead of True/False
6.0.5
Proof of concept support for hosting artifacts as Universal Packages