Skip to content

Commit 5c12503

Browse files
feature - prepare setup tools for the release of Net 11 Hosting Bundle (#171)
1 parent c73c82d commit 5c12503

4 files changed

Lines changed: 121 additions & 2 deletions

File tree

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

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,13 @@ function Get-OSServerPreReqs
186186

187187
# Check .NET Core / .NET Windows Server Hosting version
188188
$fullVersion = [version]"$MajorVersion.$MinorVersion.$PatchVersion.0"
189-
if ($fullVersion -ge [version]"11.40.2.0")
189+
if ($fullVersion -ge [version]"11.42.0.0")
190+
{
191+
$requireDotNetHostingBundle6 = $false
192+
$requireDotNetHostingBundle8Or11 = $true
193+
$requireDotNetHostingBundle10 = $false
194+
}
195+
elseif ($fullVersion -ge [version]"11.40.2.0")
190196
{
191197
$requireDotNetHostingBundle6 = $false
192198
$requireDotNetHostingBundle8 = $true
@@ -293,6 +299,51 @@ function Get-OSServerPreReqs
293299
}
294300
}
295301

302+
if ($requireDotNetHostingBundle8Or11) {
303+
$RequirementStatuses += CreateRequirementStatus -Title ".NET 8.0 or 11.0 Windows Server Hosting" `
304+
-ScriptBlock `
305+
{
306+
$Status = $False
307+
foreach ($version in GetDotNetHostingBundleVersions)
308+
{
309+
# Check version 8.0
310+
if (([version]$version).Major -eq 8 -and ([version]$version) -ge [version]$script:OSDotNetHostingBundleReq['8']['Version']) {
311+
$Status = $True
312+
}
313+
314+
# Check version 11.0
315+
if (([version]$version).Major -eq 11 -and ([version]$version) -ge [version]$script:OSDotNetHostingBundleReq['11']['Version']) {
316+
$Status = $True
317+
}
318+
}
319+
$OKMessages = @("Minimum .NET 8.0.0 or 11.0.0 Windows Server Hosting found.")
320+
$NOKMessages = @("Minimum .NET 8.0.0 or 11.0.0 Windows Server Hosting not found.")
321+
$IISStatus = $True
322+
323+
if (Get-Command Get-WebGlobalModule -errorAction SilentlyContinue)
324+
{
325+
$aspModules = Get-WebGlobalModule | Where-Object { $_.Name -eq "aspnetcoremodulev2" }
326+
if ($Status)
327+
{
328+
# Check if IIS can find ASP.NET modules
329+
if ($aspModules.Count -lt 1)
330+
{
331+
$Status = $False
332+
$IISStatus = $False
333+
$NOKMessages = @("IIS can't find ASP.NET modules")
334+
}
335+
else
336+
{
337+
$IISStatus = $True
338+
}
339+
}
340+
}
341+
342+
343+
return $(CreateResult -Status $Status -IISStatus $IISStatus -OKMessages $OKMessages -NOKMessages $NOKMessages)
344+
}
345+
}
346+
296347
if ($requireDotNetHostingBundle10) {
297348
$RequirementStatuses += CreateRequirementStatus -Title ".NET 10.0 Windows Server Hosting" `
298349
-ScriptBlock `

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,12 @@ function Install-OSServerPreReqs
197197
$installDotNetHostingBundle10 = $false
198198
# We do not set recent hosting bundle because we don't know the version we are to uninstall the others
199199
}
200+
elseif ($fullVersion -ge [version]"11.42.0.0")
201+
{
202+
$installDotNetHostingBundle6 = $false
203+
$installDotNetHostingBundle8 = $true
204+
$installDotNetHostingBundle10 = $false
205+
}
200206
elseif ($fullVersion -ge [version]"11.40.2.0")
201207
{
202208
# Here means that minor and patch version were specified and we are equal or above version 11.27.0.0
@@ -238,6 +244,10 @@ function Install-OSServerPreReqs
238244
if (([version]$version).Major -eq 10 -and ([version]$version) -ge [version]$script:OSDotNetHostingBundleReq['10']['Version']) {
239245
$installDotNetHostingBundle10 = $false
240246
}
247+
# Check .NET 10.0
248+
if (([version]$version).Major -eq 11 -and ([version]$version) -ge [version]$script:OSDotNetHostingBundleReq['11']['Version']) {
249+
$installDotNetHostingBundle8 = $false # We don't install DotNet 11 yet but we accept it
250+
}
241251
}
242252

243253
if ($installDotNetHostingBundle6) {

src/Outsystems.SetupTools/Lib/Constants.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ $OSDotNetHostingBundleReq = @{
116116
ToInstallDownloadURL = 'https://builds.dotnet.microsoft.com/dotnet/aspnetcore/Runtime/10.0.2/dotnet-hosting-10.0.2-win.exe'
117117
InstallerName = 'DotNet_WindowsHosting_10.exe'
118118
}
119+
'11' = @{
120+
Version = '11.0.0'
121+
ToInstallDownloadURL = 'https://download.visualstudio.microsoft.com/download/pr/2a7ae819-fbc4-4611-a1ba-f3b072d4ea25/32f3b931550f7b315d9827d564202eeb/dotnet-hosting-8.0.0-win.exe'
122+
InstallerName = 'DotNet_WindowsHosting_8.exe'
123+
}
119124
}
120125

121126
# .NET Core Uninstall Tool related

test/unit/Install-OSServerPreReqs.Tests.ps1

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,60 @@ InModuleScope -ModuleName OutSystems.SetupTools {
11361136
It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '27' -PatchVersion '0' -ErrorVariable err -ErrorAction SilentlyContinue } | Should Not throw }
11371137
}
11381138

1139-
# .Net 10 Hosting Bundle region
1139+
# .Net Hosting Bundle region
1140+
Context 'When trying to install prerequisites for a OS 11 version in Minor version 42 and Patch version 0 (11.42.0) with .Net 11 Hosting Bundle installed' {
1141+
1142+
Mock GetDotNet4Version { return 461808 }
1143+
Mock GetDotNetHostingBundleVersions { return '11.0.0' }
1144+
1145+
$result = Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '42' -PatchVersion '0' -ErrorVariable err -ErrorAction SilentlyContinue
1146+
1147+
It 'Should not run the .NET installation' { Assert-MockCalled @assNotRunInstallDotNet }
1148+
It 'Should not run the BuildTools installation' { Assert-MockCalled @assNotRunInstallBuildTools }
1149+
It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures }
1150+
It 'Should not run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assNotRunInstallDotNetHostingBundle }
1151+
It 'Should not run the .NET 8.0 Hosting Bundle installation' { Assert-MockCalled @assNotRunInstallDotNetHostingBundle8 }
1152+
It 'Should not run the .NET 10.0 Hosting Bundle installation' { Assert-MockCalled @assNotRunInstallDotNetHostingBundle10 }
1153+
It 'Should not run the .NET Core Uninstall Tool installation' { Assert-MockCalled @assNotRunInstallDotNetCoreUninstallTool }
1154+
It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI }
1155+
It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch }
1156+
It 'Should not disable the FIPS' { Assert-MockCalled @assNotRunDisableFIPS }
1157+
It 'Should configure the windows event log' { Assert-MockCalled @assRunConfigureWindowsEventLog }
1158+
1159+
It 'Should return the right result' {
1160+
$result.Success | Should Be $true
1161+
$result.RebootNeeded | Should Be $false
1162+
$result.ExitCode | Should Be 0
1163+
$result.Message | Should Be 'OutSystems platform server pre-requisites successfully installed'
1164+
}
1165+
It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '42' -PatchVersion '0' -ErrorVariable err -ErrorAction SilentlyContinue } | Should Not throw }
1166+
}
1167+
1168+
Context 'When trying to install prerequisites for a OS 11 version in Minor version 42 and Patch version 0 (11.42.0) without .Net Hosting Bundle installed' {
1169+
1170+
$result = Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '42' -PatchVersion '0' -ErrorVariable err -ErrorAction SilentlyContinue
1171+
1172+
It 'Should run the .NET installation' { Assert-MockCalled @assRunInstallDotNet }
1173+
It 'Should not run the BuildTools installation' { Assert-MockCalled @assNotRunInstallBuildTools }
1174+
It 'Should install the windows features installation' { Assert-MockCalled @assRunInstallWindowsFeatures }
1175+
It 'Should not run the .NET 6.0 Hosting Bundle installation' { Assert-MockCalled @assNotRunInstallDotNetHostingBundle }
1176+
It 'Should run the .NET 8.0 Hosting Bundle installation' { Assert-MockCalled @assRunInstallDotNetHostingBundle8 }
1177+
It 'Should not run the .NET 10.0 Hosting Bundle installation' { Assert-MockCalled @assNotRunInstallDotNetHostingBundle10 }
1178+
It 'Should not run the .NET Core Uninstall Tool installation' { Assert-MockCalled @assNotRunInstallDotNetCoreUninstallTool }
1179+
It 'Should configure the WMI service' { Assert-MockCalled @assRunConfigureServiceWMI }
1180+
It 'Should configure the Windows search service' { Assert-MockCalled @assRunConfigureServiceWindowsSearch }
1181+
It 'Should not disable the FIPS' { Assert-MockCalled @assNotRunDisableFIPS }
1182+
It 'Should configure the windows event log' { Assert-MockCalled @assRunConfigureWindowsEventLog }
1183+
1184+
It 'Should return the right result' {
1185+
$result.Success | Should Be $true
1186+
$result.RebootNeeded | Should Be $false
1187+
$result.ExitCode | Should Be 0
1188+
$result.Message | Should Be 'OutSystems platform server pre-requisites successfully installed'
1189+
}
1190+
It 'Should not throw' { { Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '42' -PatchVersion '0' -ErrorVariable err -ErrorAction SilentlyContinue } | Should Not throw }
1191+
}
1192+
11401193
Context 'When trying to install prerequisites for a OS 11 version in Minor version 40 and Patch version 2 (11.40.2)' {
11411194

11421195
$result = Install-OSServerPreReqs -MajorVersion '11' -MinorVersion '40' -PatchVersion '2' -ErrorVariable err -ErrorAction SilentlyContinue

0 commit comments

Comments
 (0)