From 7b29e4cba9f3c9da60a83e8931bc709bb2deff3d Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Fri, 23 Feb 2024 10:44:15 +0100 Subject: [PATCH] next major second fix (#3363) Co-authored-by: freddydk --- AppHandling/Compile-AppInNavContainer.ps1 | 4 ++-- AppHandling/Get-NavContainerAppInfo.ps1 | 2 +- AppHandling/Publish-NavContainerApp.ps1 | 5 +++-- AppHandling/Run-AlPipeline.ps1 | 2 +- NuGet/Publish-BcNuGetPackageToContainer.ps1 | 6 +++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/AppHandling/Compile-AppInNavContainer.ps1 b/AppHandling/Compile-AppInNavContainer.ps1 index 82ffd4779..bf3b64377 100644 --- a/AppHandling/Compile-AppInNavContainer.ps1 +++ b/AppHandling/Compile-AppInNavContainer.ps1 @@ -436,7 +436,7 @@ try { Write-Host "Processing dependency $($dependency.Publisher)_$($dependency.Name)_$($dependency.Version) ($($dependency.AppId))" $existingApp = $existingApps | Where-Object { if ($platformversion -ge [System.Version]"19.0.0.0") { - ((($dependency.appId -ne '' -and $_.AppId -eq $dependency.appId) -or ($dependency.appId -eq '' -and $_.Name -eq $dependency.Name)) -and ([System.Version]$_.Version -ge [System.Version]$dependency.version)) + ((($dependency.appId -ne '' -and $_.AppId.value.ToString() -eq $dependency.appId) -or ($dependency.appId -eq '' -and $_.Name -eq $dependency.Name)) -and ([System.Version]$_.Version -ge [System.Version]$dependency.version)) } else { (($_.Name -eq $dependency.name) -and ($_.Name -eq "Application" -or (($_.Publisher -eq $dependency.publisher) -and ([System.Version]$_.Version -ge [System.Version]$dependency.version)))) @@ -606,7 +606,7 @@ try { $dependency = $_ $dependencyAppId = "$(if ($dependency.PSObject.Properties.name -eq 'AppId') { $dependency.AppId } else { $dependency.Id })" Write-Host "Dependency: Id=$dependencyAppId, Publisher=$($dependency.Publisher), Name=$($dependency.Name), Version=$($dependency.Version)" - $existingApps | Where-Object { $_.AppId -eq [System.Guid]$dependencyAppId -and $_.Version -gt [System.Version]$dependency.Version } | ForEach-Object { + $existingApps | Where-Object { "$($_.AppId)" -eq $dependencyAppId -and $_.Version -gt [System.Version]$dependency.Version } | ForEach-Object { $dependency.Version = "$($_.Version)" Write-Host "- Set dependency version to $($_.Version)" $changes = $true diff --git a/AppHandling/Get-NavContainerAppInfo.ps1 b/AppHandling/Get-NavContainerAppInfo.ps1 index 1e4585a06..34cc7f50d 100644 --- a/AppHandling/Get-NavContainerAppInfo.ps1 +++ b/AppHandling/Get-NavContainerAppInfo.ps1 @@ -108,7 +108,7 @@ try { } else { $inArgs += @{ "ServerInstance" = $ServerInstance } - $apps = Get-NAVAppInfo @inArgs | Where-Object { (!$installedOnly) -or ($_.IsInstalled -eq $true) } | ForEach-Object { Get-NAVAppInfo -id "$($_.AppId)" -publisher $_.publisher -name $_.name -version $_.Version @inArgs } + $apps = Get-NAVAppInfo @inArgs | Where-Object { (!$installedOnly) -or ($_.IsInstalled -eq $true) } | ForEach-Object { Get-NAVAppInfo -id $_.AppId.value -publisher $_.publisher -name $_.name -version $_.Version @inArgs } } if ($sort -ne "None") { diff --git a/AppHandling/Publish-NavContainerApp.ps1 b/AppHandling/Publish-NavContainerApp.ps1 index c1e78ad1f..8e20499c4 100644 --- a/AppHandling/Publish-NavContainerApp.ps1 +++ b/AppHandling/Publish-NavContainerApp.ps1 @@ -130,7 +130,7 @@ try { if ($checkAlreadyInstalled) { # Get Installed apps (if UseDevEndpoint is specified, only get global apps) $installedApps = Get-BcContainerAppInfo -containerName $containerName -installedOnly | Where-Object { (-not $useDevEndpoint.IsPresent) -or ($_.Scope -eq 'Global') } | ForEach-Object { - @{ "id" = $_.appId; "publisher" = $_.publisher; "name" = $_.name; "version" = $_.Version } + @{ "id" = $_.appId.value.ToString(); "publisher" = $_.publisher; "name" = $_.name; "version" = $_.Version } } } } @@ -143,7 +143,8 @@ try { # Get Installed apps (if UseDevEndpoint is specified, only get global apps) $installedApps = Invoke-ScriptInCloudBcContainer -authContext $bcAuthContext -containerId $environment -scriptblock { Get-NAVAppInfo -ServerInstance $serverInstance -TenantSpecificProperties -tenant 'default' | Where-Object { $_.IsInstalled -eq $true -and ((-not $useDevEndpoint.IsPresent) -or ($_.Scope -eq 'Global')) } | ForEach-Object { - Get-NAVAppInfo -ServerInstance $serverInstance -TenantSpecificProperties -tenant 'default' -id $_.AppId -publisher $_.publisher -name $_.name -version $_.Version } + Get-NAVAppInfo -ServerInstance $serverInstance -TenantSpecificProperties -tenant 'default' -id $_.AppId.value -publisher $_.publisher -name $_.name -version $_.Version } | ForEach-Object { + @{ "id" = $_.appId.value.ToString(); "publisher" = $_.publisher; "name" = $_.name; "version" = $_.Version } } } else { diff --git a/AppHandling/Run-AlPipeline.ps1 b/AppHandling/Run-AlPipeline.ps1 index 4592a0403..5819f9373 100644 --- a/AppHandling/Run-AlPipeline.ps1 +++ b/AppHandling/Run-AlPipeline.ps1 @@ -1829,7 +1829,7 @@ Write-Host -ForegroundColor Yellow @' param($appFile) Get-NavAppInfo -Path $appFile } -argumentList (Get-BcContainerPath -containerName $containerName -path $appFile) - $appId = $appInfo.AppId + $appId = $appInfo.AppId.ToString() } else { $tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) diff --git a/NuGet/Publish-BcNuGetPackageToContainer.ps1 b/NuGet/Publish-BcNuGetPackageToContainer.ps1 index 5679daec5..24552f88e 100644 --- a/NuGet/Publish-BcNuGetPackageToContainer.ps1 +++ b/NuGet/Publish-BcNuGetPackageToContainer.ps1 @@ -69,8 +69,8 @@ Function Publish-BcNuGetPackageToContainer { $isCloudBcContainer = isCloudBcContainer -authContext $bcAuthContext -containerId $environment if ($isCloudBcContainer) { $installedApps = @(Invoke-ScriptInCloudBcContainer -authContext $bcAuthContext -containerId $environment -scriptblock { - Get-NAVAppInfo -ServerInstance $serverInstance -TenantSpecificProperties -tenant 'default' | Where-Object { $_.IsInstalled -eq $true } | ForEach-Object { Get-NAVAppInfo -ServerInstance $serverInstance -TenantSpecificProperties -tenant 'default' -id $_.AppId -publisher $_.publisher -name $_.name -version $_.Version } - } | ForEach-Object { @{ "Publisher" = $_.Publisher; "Name" = $_.Name; "Id" = $_.AppId; "Version" = $_.Version } } ) + Get-NAVAppInfo -ServerInstance $serverInstance -TenantSpecificProperties -tenant 'default' | Where-Object { $_.IsInstalled -eq $true } | ForEach-Object { Get-NAVAppInfo -ServerInstance $serverInstance -TenantSpecificProperties -tenant 'default' -id $_.AppId.value -publisher $_.publisher -name $_.name -version $_.Version } + } | ForEach-Object { @{ "Publisher" = $_.Publisher; "Name" = $_.Name; "Id" = $_.AppId.value.ToString(); "Version" = $_.Version } } ) # Get Country and Platform from the container } else { @@ -81,7 +81,7 @@ Function Publish-BcNuGetPackageToContainer { } } else { - $installedApps = @(Get-BcContainerAppInfo -containerName $containerName -installedOnly | ForEach-Object { @{ "Publisher" = $_.Publisher; "Name" = $_.Name; "Id" = $_.AppId; "Version" = $_.Version } } ) + $installedApps = @(Get-BcContainerAppInfo -containerName $containerName -installedOnly | ForEach-Object { @{ "Publisher" = $_.Publisher; "Name" = $_.Name; "Id" = $_.AppId.value.ToString(); "Version" = $_.Version } } ) $installedPlatform = [System.Version](Get-BcContainerPlatformVersion -containerOrImageName $containerName) $installedCountry = (Get-BcContainerCountry -containerOrImageName $containerName).ToLowerInvariant() }