From 943df1d062203fe37e88e20e9f4e394d2d7d004c Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sun, 17 Dec 2023 09:12:21 +0100 Subject: [PATCH] Dotnet8 (#3273) latest ALC.EXE has a dependency on dotnet 8.0.0 This PR will JIT install that. --------- Co-authored-by: freddydk --- ContainerHandling/New-NavContainer.ps1 | 15 ++++++++++++++- ContainerHandling/New-NavImage.ps1 | 10 ++++++++-- ReleaseNotes.txt | 1 + 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ContainerHandling/New-NavContainer.ps1 b/ContainerHandling/New-NavContainer.ps1 index 4b8b401b2..48a1bb0be 100644 --- a/ContainerHandling/New-NavContainer.ps1 +++ b/ContainerHandling/New-NavContainer.ps1 @@ -1733,12 +1733,25 @@ Get-NavServerUser -serverInstance $ServerInstance -tenant default |? LicenseType ') | Set-Content -Path "$myfolder\HelperFunctions.ps1" } Write-Host "Patching container to install dotnet 6.0.13" - Download-File -source "https://bcartifacts.blob.core.windows.net/prerequisites/dotnet-hosting-6.0.13-win.exe" -destinationFile (Join-Path $myFolder "dotnet-win.exe") + 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") (' if (Test-Path "c:\run\my\dotnet-win.exe") { Write-Host "Generic image is 1.0.2.13 or below, 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 } ') | Add-Content -Path "$myfolder\HelperFunctions.ps1" } + if ($version.Major -ge 24 -and $genericTag -le [System.Version]"1.0.2.14") { + if (!(Test-Path -Path "$myfolder\HelperFunctions.ps1")) { + ('# Invoke default behavior + . (Join-Path $runPath $MyInvocation.MyCommand.Name) + ') | Set-Content -Path "$myfolder\HelperFunctions.ps1" + } + Write-Host "Patching container to install dotnet 8.0.0" + Download-File -source "https://download.visualstudio.microsoft.com/download/pr/2a7ae819-fbc4-4611-a1ba-f3b072d4ea25/32f3b931550f7b315d9827d564202eeb/dotnet-hosting-8.0.0-win.exe" -destinationFile (Join-Path $myFolder "dotnet-win8.exe") + (' +if (Test-Path "c:\run\my\dotnet-win8.exe") { Write-Host "Generic image is 1.0.2.14 or below, installing dotnet 8.0.0"; start-process -Wait -FilePath "c:\run\my\dotnet-win8.exe" -ArgumentList /quiet; Remove-Item "c:\run\my\dotnet-win8.exe" -Force } +') | Add-Content -Path "$myfolder\HelperFunctions.ps1" + } + if ($updateHosts) { Copy-Item -Path (Join-Path $PSScriptRoot "updatehosts.ps1") -Destination (Join-Path $myfolder "updatehosts.ps1") -Force $parameters += "--volume ""c:\windows\system32\drivers\etc:C:\driversetc""" diff --git a/ContainerHandling/New-NavImage.ps1 b/ContainerHandling/New-NavImage.ps1 index e826ddc4a..b96da710c 100644 --- a/ContainerHandling/New-NavImage.ps1 +++ b/ContainerHandling/New-NavImage.ps1 @@ -476,11 +476,17 @@ 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://bcartifacts.blob.core.windows.net/prerequisites/dotnet-hosting-6.0.13-win.exe" ) + $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' } - + + 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 | ForEach-Object { if ($_ -is [string]) { if ($_.StartsWith("https://", "OrdinalIgnoreCase") -or $_.StartsWith("http://", "OrdinalIgnoreCase")) { diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 558eff3a7..1235530de 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -1,4 +1,5 @@ 6.0.3 +Just-In-Time install dotnet 8.0.0 for Business Central version 24 or above (needed by alc.exe) 6.0.2 Compile-AppInBcContainer: When checking whether symbol download is needed, the Application dependency wasn't checked for version number