Skip to content

Commit 16501b1

Browse files
R11PIT-775 - Update hosting bundle from .NET Core 3.1 to .NET 6.0 (#112)
* R11PIT-775 - Update hosting bundle from .NET Core 3.1 to .NET 6.0 * Update comments * Update wrong version * Fix comment * Bumped version and updated CHANGELOG Co-authored-by: Luísa Lourenço <luisa.lourenco@outsystems.com>
1 parent edc92c2 commit 16501b1

8 files changed

Lines changed: 447 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Outsystems.SetupTools Release History
22

3+
## 3.16.0.0
4+
5+
- Upgrade the hosting bundle to .NET 6.0
6+
37
## 3.15.0.0
48

59
- Fix lifetime installer checks

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 3.15.0.{build}
1+
version: 3.16.0.{build}
22

33
only_commits:
44
files:

src/Outsystems.SetupTools/Functions/Get-OSServerPreReqs.ps1

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,28 +163,39 @@ function Get-OSServerPreReqs
163163
}
164164
default
165165
{
166-
# Check .NET Core Windows Server Hosting version
166+
# Check .NET Core / .NET Windows Server Hosting version
167167
$fullVersion = [version]"$MajorVersion.$MinorVersion.$PatchVersion.0"
168168
if ($fullVersion -eq [version]"$MajorVersion.0.0.0")
169169
{
170170
# Here means that no specific minor and patch version were specified
171-
# So we install both versions
171+
# So we install all versions
172172
$requireDotNetCoreHostingBundle2 = $true
173173
$requireDotNetCoreHostingBundle3 = $true
174+
$requireDotNetHostingBundle6 = $true
175+
}
176+
elseif ($fullVersion -ge [version]"11.17.1.0")
177+
{
178+
# Here means that minor and patch version were specified and we are equal or above version 11.17.1.0
179+
# We install .NET 6.0 only
180+
$requireDotNetCoreHostingBundle2 = $false
181+
$requireDotNetCoreHostingBundle3 = $false
182+
$requireDotNetHostingBundle6 = $true
174183
}
175184
elseif ($fullVersion -ge [version]"11.12.2.0")
176185
{
177186
# Here means that minor and patch version were specified and we are equal or above version 11.12.2.0
178-
# We install version 3 only
187+
# We install .NET Core 3.1 only
179188
$requireDotNetCoreHostingBundle2 = $false
180189
$requireDotNetCoreHostingBundle3 = $true
190+
$requireDotNetHostingBundle6 = $false
181191
}
182192
else
183193
{
184194
# Here means that minor and patch version were specified and we are below version 11.12.2.0
185-
# We install version 2 only
195+
# We install .NET Core 2.1 only
186196
$requireDotNetCoreHostingBundle2 = $true
187197
$requireDotNetCoreHostingBundle3 = $false
198+
$requireDotNetHostingBundle6 = $false
188199
}
189200

190201
if($requireDotNetCoreHostingBundle2) {
@@ -194,7 +205,7 @@ function Get-OSServerPreReqs
194205
$Status = $False
195206
foreach ($version in GetDotNetCoreHostingBundleVersions)
196207
{
197-
# Check version 2.1
208+
# Check .NET Core 2.1
198209
if (([version]$version).Major -eq 2 -and ([version]$version) -ge [version]$script:OSDotNetCoreHostingBundleReq['2']['Version']) {
199210
$Status = $True
200211
}
@@ -234,7 +245,7 @@ function Get-OSServerPreReqs
234245
$Status = $False
235246
foreach ($version in GetDotNetCoreHostingBundleVersions)
236247
{
237-
# Check version 3.1
248+
# Check .NET Core 3.1
238249
if (([version]$version).Major -eq 3 -and ([version]$version) -ge [version]$script:OSDotNetCoreHostingBundleReq['3']['Version']) {
239250
$Status = $True
240251
}
@@ -263,6 +274,46 @@ function Get-OSServerPreReqs
263274
}
264275

265276

277+
return $(CreateResult -Status $Status -IISStatus $IISStatus -OKMessages $OKMessages -NOKMessages $NOKMessages)
278+
}
279+
}
280+
281+
if ($requireDotNetHostingBundle6) {
282+
$RequirementStatuses += CreateRequirementStatus -Title ".NET 6.0 Windows Server Hosting" `
283+
-ScriptBlock `
284+
{
285+
$Status = $False
286+
foreach ($version in GetDotNetHostingBundleVersions)
287+
{
288+
# Check version 6.0
289+
if (([version]$version).Major -eq 6 -and ([version]$version) -ge [version]$script:OSDotNetHostingBundleReq['6']['Version']) {
290+
$Status = $True
291+
}
292+
}
293+
$OKMessages = @("Minimum .NET 6.0.6 Windows Server Hosting found.")
294+
$NOKMessages = @("Minimum .NET 6.0.6 Windows Server Hosting not found.")
295+
$IISStatus = $True
296+
297+
if (Get-Command Get-WebGlobalModule -errorAction SilentlyContinue)
298+
{
299+
$aspModules = Get-WebGlobalModule | Where-Object { $_.Name -eq "aspnetcoremodulev2" }
300+
if ($Status)
301+
{
302+
# Check if IIS can find ASP.NET modules
303+
if ($aspModules.Count -lt 1)
304+
{
305+
$Status = $False
306+
$IISStatus = $False
307+
$NOKMessages = @("IIS can't find ASP.NET modules")
308+
}
309+
else
310+
{
311+
$IISStatus = $True
312+
}
313+
}
314+
}
315+
316+
266317
return $(CreateResult -Status $Status -IISStatus $IISStatus -OKMessages $OKMessages -NOKMessages $NOKMessages)
267318
}
268319
}

src/Outsystems.SetupTools/Functions/Install-OSServerPreReqs.ps1

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,47 +146,70 @@ function Install-OSServerPreReqs
146146
}
147147
default
148148
{
149-
# Check .NET Core Windows Server Hosting version
149+
# Check .NET Core / .NET Windows Server Hosting version
150150
$fullVersion = [version]"$MajorVersion.$MinorVersion.$PatchVersion.0"
151151
if ($fullVersion -eq [version]"$MajorVersion.0.0.0")
152152
{
153153
# Here means that no specific minor and patch version were specified
154-
# So we install both versions
154+
# So we install all versions
155155
$installDotNetCoreHostingBundle2 = $true
156156
$installDotNetCoreHostingBundle3 = $true
157+
$installDotNetHostingBundle6 = $true
158+
}
159+
elseif ($fullVersion -ge [version]"11.17.1.0")
160+
{
161+
# Here means that minor and patch version were specified and we are equal or above version 11.17.1.0
162+
# We install .NET 6.0 only
163+
$installDotNetCoreHostingBundle2 = $false
164+
$installDotNetCoreHostingBundle3 = $false
165+
$installDotNetHostingBundle6 = $true
157166
}
158167
elseif ($fullVersion -ge [version]"11.12.2.0")
159168
{
160169
# Here means that minor and patch version were specified and we are equal or above version 11.12.2.0
161170
# We install version 3 only
162171
$installDotNetCoreHostingBundle2 = $false
163172
$installDotNetCoreHostingBundle3 = $true
173+
$installDotNetHostingBundle6 = $false
164174
}
165175
else
166176
{
167177
# Here means that minor and patch version were specified and we are below version 11.12.2.0
168178
# We install version 2 only
169179
$installDotNetCoreHostingBundle2 = $true
170180
$installDotNetCoreHostingBundle3 = $false
181+
$installDotNetHostingBundle6 = $false
171182
}
172183

173184
foreach ($version in GetDotNetCoreHostingBundleVersions)
174185
{
175-
# Check version 2.1
186+
# Check .NET Core 2.1
176187
if (([version]$version).Major -eq 2 -and ([version]$version) -ge [version]$script:OSDotNetCoreHostingBundleReq['2']['Version']) {
177188
$installDotNetCoreHostingBundle2 = $false
178189
}
179-
# Check version 3.1
190+
# Check .NET Core 3.1
180191
if (([version]$version).Major -eq 3 -and ([version]$version) -ge [version]$script:OSDotNetCoreHostingBundleReq['3']['Version']) {
181192
$installDotNetCoreHostingBundle3 = $false
182193
}
183194
}
195+
196+
foreach ($version in GetDotNetHostingBundleVersions)
197+
{
198+
# Check .NET 6.0
199+
if (([version]$version).Major -eq 6 -and ([version]$version) -ge [version]$script:OSDotNetHostingBundleReq['6']['Version']) {
200+
$installDotNetHostingBundle6 = $false
201+
}
202+
}
203+
184204
if ($installDotNetCoreHostingBundle2) {
185205
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Minimum .NET Core Windows Server Hosting version 2.1 for OutSystems $MajorVersion not found. We will try to download and install the latest .NET Core Windows Server Hosting bundle"
186206
}
187207
if ($installDotNetCoreHostingBundle3) {
188208
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Minimum .NET Core Windows Server Hosting version 3.1 for OutSystems $MajorVersion not found. We will try to download and install the latest .NET Core Windows Server Hosting bundle"
189209
}
210+
if ($installDotNetHostingBundle6) {
211+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Minimum .NET Windows Server Hosting version 6.0.6 for OutSystems $MajorVersion not found. We will try to download and install the latest .NET Windows Server Hosting bundle"
212+
}
190213
}
191214
}
192215

@@ -423,6 +446,64 @@ function Install-OSServerPreReqs
423446
}
424447
}
425448

449+
# Install .NET Windows Server Hosting bundle version 6
450+
if ($installDotNetHostingBundle6)
451+
{
452+
try
453+
{
454+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message "Installing .NET 6.0 Windows Server Hosting bundle"
455+
$exitCode = InstallDotNetHostingBundle -MajorVersion '6' -Sources $SourcePath
456+
}
457+
catch [System.IO.FileNotFoundException]
458+
{
459+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Exception $_.Exception -Stream 3 -Message ".NET 6.0 installer not found"
460+
WriteNonTerminalError -Message ".NET 6.0 installer not found"
461+
462+
$installResult.Success = $false
463+
$installResult.ExitCode = -1
464+
$installResult.Message = '.NET 6.0 installer not found'
465+
466+
return $installResult
467+
}
468+
catch
469+
{
470+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Exception $_.Exception -Stream 3 -Message "Error downloading or starting the .NET 6.0 installation"
471+
WriteNonTerminalError -Message "Error downloading or starting the .NET 6.0 installation"
472+
473+
$installResult.Success = $false
474+
$installResult.ExitCode = -1
475+
$installResult.Message = 'Error downloading or starting the .NET 6.0 installation'
476+
477+
return $installResult
478+
}
479+
480+
switch ($exitCode)
481+
{
482+
0
483+
{
484+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message ".NET 6.0 Windows Server Hosting bundle successfully installed."
485+
}
486+
487+
{ $_ -in 3010, 3011 }
488+
{
489+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 0 -Message ".NET 6.0 Windows Server Hosting bundle successfully installed but a reboot is needed. Exit code: $exitCode"
490+
$installResult.RebootNeeded = $true
491+
}
492+
493+
default
494+
{
495+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 3 -Message "Error installing .NET 6.0 Windows Server Hosting bundle. Exit code: $exitCode"
496+
WriteNonTerminalError -Message "Error installing .NET 6.0 Windows Server Hosting bundle. Exit code: $exitCode"
497+
498+
$installResult.Success = $false
499+
$installResult.ExitCode = $exitCode
500+
$installResult.Message = 'Error installing .NET 6.0 Windows Server Hosting bundle'
501+
502+
return $installResult
503+
}
504+
}
505+
}
506+
426507
# Install .NET
427508
if ($installDotNet)
428509
{

src/Outsystems.SetupTools/Lib/Constants.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,16 @@ $OSDotNetCoreHostingBundleReq = @{
127127
}
128128
}
129129

130+
# .NET Hosting Bundle related
131+
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
132+
$OSDotNetHostingBundleReq = @{
133+
'6' = @{
134+
Version = '6.0.6'
135+
ToInstallDownloadURL = 'https://download.visualstudio.microsoft.com/download/pr/0d000d1b-89a4-4593-9708-eb5177777c64/cfb3d74447ac78defb1b66fd9b3f38e0/dotnet-hosting-6.0.6-win.exe'
136+
InstallerName = 'DotNet_WindowsHosting_6.exe'
137+
}
138+
}
139+
130140
# Database default timeout
131141
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseDeclaredVarsMoreThanAssigments', '')]
132142
$OSDBTimeout = "60"

src/Outsystems.SetupTools/Lib/PlatformSetup.ps1

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,32 @@ function GetDotNetCoreHostingBundleVersions()
133133
return $version
134134
}
135135

136+
function GetDotNetHostingBundleVersions()
137+
{
138+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Getting the contents of the registry key HKLM:SOFTWARE\WOW6432Node\Microsoft\Updates\.NET\Microsoft .Net<*>Windows Server Hosting<*>\PackageVersion"
139+
140+
$rootPath = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Updates\.NET'
141+
$filter = 'Microsoft .Net*Windows Server Hosting*'
142+
143+
try
144+
{
145+
$version = $(Get-ChildItem -Path $rootPath -ErrorAction Stop | Where-Object { $_.PSChildName -like $filter } | Get-ItemProperty -ErrorAction Stop).PackageVersion | Sort-Object -Descending
146+
}
147+
catch
148+
{
149+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message $($_.Exception.Message)
150+
}
151+
152+
if (-not $version)
153+
{
154+
$version = '0.0.0.0'
155+
}
156+
157+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Returning $version"
158+
159+
return $version
160+
}
161+
136162
function InstallDotNet([string]$Sources, [string]$URL)
137163
{
138164
if ($Sources)
@@ -431,6 +457,40 @@ function InstallDotNetCoreHostingBundle([string]$MajorVersion, [string]$Sources)
431457
return $($result.ExitCode)
432458
}
433459

460+
function InstallDotNetHostingBundle([string]$MajorVersion, [string]$Sources)
461+
{
462+
if ($Sources)
463+
{
464+
if (Test-Path "$Sources\$($script:OSDotNetHostingBundleReq[$MajorVersion]['InstallerName'])")
465+
{
466+
$installer = "$Sources\$($script:OSDotNetHostingBundleReq[$MajorVersion]['InstallerName'])"
467+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Using local file: $installer"
468+
}
469+
# If Windows is set to hide file extensions from file names, the file could have been stored with double extension by mistake.
470+
elseif (Test-Path "$Sources\$($script:OSDotNetHostingBundleReq[$MajorVersion]['InstallerName']).exe")
471+
{
472+
$installer = "$($script:OSDotNetHostingBundleReq[$MajorVersion]['InstallerName']).exe"
473+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Using local fallback file: $installer"
474+
}
475+
else {
476+
throw [System.IO.FileNotFoundException] "$installerName.exe not found."
477+
}
478+
}
479+
else
480+
{
481+
$installer = "$ENV:TEMP\$($script:OSDotNetHostingBundleReq[$MajorVersion]['InstallerName'])"
482+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Downloading sources from: $($script:OSDotNetHostingBundleReq[$MajorVersion]['ToInstallDownloadURL'])"
483+
DownloadOSSources -URL $($script:OSDotNetHostingBundleReq[$MajorVersion]['ToInstallDownloadURL']) -SavePath $installer
484+
}
485+
486+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Starting the installation"
487+
$result = Start-Process -FilePath $installer -ArgumentList "/install", "/quiet", "/norestart" -Wait -PassThru -ErrorAction Stop
488+
489+
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Installation finished. Returnig $($result.ExitCode)"
490+
491+
return $($result.ExitCode)
492+
}
493+
434494
function InstallErlang([string]$InstallDir, [string]$Sources)
435495
{
436496
LogMessage -Function $($MyInvocation.Mycommand) -Phase 1 -Stream 2 -Message "Starting the installation"

src/Outsystems.SetupTools/OutSystems.SetupTools.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'OutSystems.SetupTools.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '3.15.0.0'
15+
ModuleVersion = '3.16.0.0'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()

0 commit comments

Comments
 (0)