From a17e0748b9bc59dbafad579300241d0e08f7b65e Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Mon, 19 Feb 2024 15:52:28 +0100 Subject: [PATCH] fix new image bugs (#3344) Fix bugs after new generic image Co-authored-by: freddydk --- ContainerHandling/New-NavContainer.ps1 | 14 +++++++------- ContainerHandling/New-NavImage.ps1 | 19 +++++++++++++------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/ContainerHandling/New-NavContainer.ps1 b/ContainerHandling/New-NavContainer.ps1 index 55fbd27c5..cb5641f0a 100644 --- a/ContainerHandling/New-NavContainer.ps1 +++ b/ContainerHandling/New-NavContainer.ps1 @@ -1732,10 +1732,10 @@ Get-NavServerUser -serverInstance $ServerInstance -tenant default |? LicenseType . (Join-Path $runPath $MyInvocation.MyCommand.Name) ') | Set-Content -Path "$myfolder\HelperFunctions.ps1" } - Write-Host "Patching container to install dotnet 6.0.13" - Download-File -source "https://download.visualstudio.microsoft.com/download/pr/0cb3c095-c4f4-4d55-929b-3b4888a7b5f1/4156664d6bfcb46b63916a8cd43f8305/dotnet-hosting-6.0.13-win.exe" -destinationFile (Join-Path $myFolder "dotnet-win.exe") + Write-Host "Patching container to install dotnet 6.0.27" + Download-File -source "https://download.visualstudio.microsoft.com/download/pr/04389c24-12a9-4e0e-8498-31989f30bb22/141aef28265938153eefad0f2398a73b/dotnet-hosting-6.0.27-win.exe" -destinationFile (Join-Path $myFolder "dotnet6-win.exe") (' -if (Test-Path "c:\run\my\dotnet-win.exe") { Write-Host "Installing dotnet 6.0.13"; start-process -Wait -FilePath "c:\run\my\dotnet-win.exe" -ArgumentList /quiet; Remove-Item "c:\run\my\dotnet-win.exe" -Force } +if (Test-Path "c:\run\my\dotnet6-win.exe") { Write-Host "Installing dotnet 6.0.27"; start-process -Wait -FilePath "c:\run\my\dotnet6-win.exe" -ArgumentList /quiet; Remove-Item "c:\run\my\dotnet6-win.exe" -Force } ') | Add-Content -Path "$myfolder\HelperFunctions.ps1" } @@ -2330,10 +2330,10 @@ if (-not `$restartingInstance) { if ($Version.Major -ge 22) { Invoke-ScriptInBcContainer -containerName $containerName -scriptblock { Write-Host "Cleanup old dotnet core assemblies" - Remove-Item -Path 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.4' -Recurse -Force -ErrorAction SilentlyContinue - Remove-Item -Path 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1' -Recurse -Force -ErrorAction SilentlyContinue - Remove-Item -Path 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.4' -Recurse -Force -ErrorAction SilentlyContinue - Remove-Item -Path 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\5.0.4' -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.0.*' -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.*' -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.*' -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\5.0.*' -Recurse -Force -ErrorAction SilentlyContinue } } diff --git a/ContainerHandling/New-NavImage.ps1 b/ContainerHandling/New-NavImage.ps1 index b96da710c..77f1ca47f 100644 --- a/ContainerHandling/New-NavImage.ps1 +++ b/ContainerHandling/New-NavImage.ps1 @@ -476,15 +476,22 @@ try { $myscripts += @( "https://raw.githubusercontent.com/microsoft/nav-docker/master/generic/Run/210-new/SetupConfiguration.ps1" ) Write-Host "Patching prompt.ps1 due to issue #2891" $myScripts += @( "https://raw.githubusercontent.com/microsoft/nav-docker/master/generic/Run/Prompt.ps1" ) - $myScripts += @( "https://download.visualstudio.microsoft.com/download/pr/0cb3c095-c4f4-4d55-929b-3b4888a7b5f1/4156664d6bfcb46b63916a8cd43f8305/dotnet-hosting-6.0.13-win.exe" ) - Write-Host "Base image is generic image 1.0.2.13 or below, installing dotnet 6.0.13" - $InstallDotNet = 'RUN start-process -Wait -FilePath "c:\run\dotnet-hosting-6.0.13-win.exe" -ArgumentList /quiet' + $myScripts += @( "https://download.visualstudio.microsoft.com/download/pr/04389c24-12a9-4e0e-8498-31989f30bb22/141aef28265938153eefad0f2398a73b/dotnet-hosting-6.0.27-win.exe" ) + Write-Host "Base image is generic image 1.0.2.13 or below, installing dotnet 6.0.27" + $InstallDotNet = 'RUN start-process -Wait -FilePath "c:\run\dotnet-hosting-6.0.27-win.exe" -ArgumentList /quiet' } if ($genericTag -le [Version]"1.0.2.14" -and [Version]$appManifest.Version -ge [Version]"24.0.0.0") { - $myScripts += @( "https://download.visualstudio.microsoft.com/download/pr/2a7ae819-fbc4-4611-a1ba-f3b072d4ea25/32f3b931550f7b315d9827d564202eeb/dotnet-hosting-8.0.0-win.exe" ) - Write-Host "Base image is generic image 1.0.2.14 or below, installing dotnet 8.0.0" - $InstallDotNet = 'RUN start-process -Wait -FilePath "c:\run\dotnet-hosting-8.0.0-win.exe" -ArgumentList /quiet' + $myScripts += @( "https://download.visualstudio.microsoft.com/download/pr/98ff0a08-a283-428f-8e54-19841d97154c/8c7d5f9600eadf264f04c82c813b7aab/dotnet-hosting-8.0.2-win.exe" ) + $myScripts += @( "https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/PowerShell-7.4.1-win-x64.msi" ) + Write-Host "Base image is generic image 1.0.2.14 or below, installing dotnet 8.0.2" + $InstallDotNet = 'RUN start-process -Wait -FilePath "c:\run\dotnet-hosting-8.0.2-win.exe" -ArgumentList /quiet ; start-process -Wait -FilePath c:\run\powershell-7.4.1-win-x64.msi -ArgumentList /quiet' + } + + if ($genericTag -ge [Version]"1.0.2.15" -and [Version]$appManifest.Version -ge [Version]"15.0.0.0" -and [Version]$appManifest.Version -lt [Version]"19.0.0.0") { + $myScripts += @( "https://download.microsoft.com/download/6/F/B/6FB4F9D2-699B-4A40-A674-B7FF41E0E4D2/DotNetCore.1.0.7_1.1.4-WindowsHosting.exe" ) + Write-Host "Base image is generic image 1.0.2.15 or higher, installing ASP.NET Core 1.1" + $InstallDotNet = 'RUN start-process -Wait -FilePath "c:\run\DotNetCore.1.0.7_1.1.4-WindowsHosting.exe" -ArgumentList /quiet' } $myScripts | ForEach-Object {