Skip to content

Commit

Permalink
fix new image bugs (#3344)
Browse files Browse the repository at this point in the history
Fix bugs after new generic image

Co-authored-by: freddydk <[email protected]>
  • Loading branch information
freddydk and freddydk authored Feb 19, 2024
1 parent 57c5b1e commit a17e074
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
14 changes: 7 additions & 7 deletions ContainerHandling/New-NavContainer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down Expand Up @@ -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
}
}

Expand Down
19 changes: 13 additions & 6 deletions ContainerHandling/New-NavImage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a17e074

Please sign in to comment.