diff --git a/eng/dockerfile-templates/runtime/Dockerfile b/eng/dockerfile-templates/runtime/Dockerfile index 9a629991..80a5526a 100644 --- a/eng/dockerfile-templates/runtime/Dockerfile +++ b/eng/dockerfile-templates/runtime/Dockerfile @@ -19,8 +19,6 @@ ) ) ^ - set installNet35UsingWU to OS_VERSION_NUMBER = "ltsc2025" ^ - set winver to when( OS_VERSION_NUMBER = "ltsc2019" || OS_VERSION_NUMBER = "ltsc2022", "windows10.0", @@ -40,18 +38,8 @@ if OS_VERSION_NUMBER != "ltsc2019" || PRODUCT_VERSION = "4.8" || PRODUCT_VERSION }}COMPLUS_NGenProtectedProcess_FeatureEnabled=0 RUN ` -{{if PRODUCT_VERSION = "3.5" && installNet35UsingWU -: # Install .NET Fx 3.5 - dism /Online /Add-Capability /CapabilityName:NetFx3 ` - ` -^elif PRODUCT_VERSION = "3.5" -: # Install .NET Fx 3.5 - curl -fSLo microsoft-windows-netfx3.zip https://dotnetbinaries.blob.core.windows.net/dockerassets/microsoft-windows-netfx3-{{OS_VERSION_NUMBER}}.zip ` - && tar -zxf microsoft-windows-netfx3.zip ` - && del /F /Q microsoft-windows-netfx3.zip ` - && dism /Online /Quiet /Add-Package /PackagePath:.\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab ` - && del microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab ` - && powershell Remove-Item -Force -Recurse ${Env:TEMP}\* ` +{{if PRODUCT_VERSION = "3.5" +: {{InsertTemplate("Dockerfile.install-netfx3", [], " ")}} ` ` ^elif (OS_VERSION_NUMBER = "ltsc2019" && PRODUCT_VERSION = "4.8") || (OS_VERSION_NUMBER != "ltsc2025" && PRODUCT_VERSION = "4.8.1") : # Install .NET Fx {{PRODUCT_VERSION}} diff --git a/eng/dockerfile-templates/runtime/Dockerfile.install-netfx3 b/eng/dockerfile-templates/runtime/Dockerfile.install-netfx3 new file mode 100644 index 00000000..a2dac633 --- /dev/null +++ b/eng/dockerfile-templates/runtime/Dockerfile.install-netfx3 @@ -0,0 +1,24 @@ +{{ + + _ Features on Demand (FoDs) are supported on Windows Server 2022 and later. + Using DISM /add-package to add FODs is deprecated. + It is best practice to add all FODs with DISM /Add-Capability. ^ + _ https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/features-on-demand-v2--capabilities#overview ^ + + set useCapability to + OS_VERSION_NUMBER != "ltsc2016" && + OS_VERSION_NUMBER != "ltsc2019" ^ + + set enableWindowsUpdate to !useCapability ^ + set dismArgs to when(useCapability, + "/Add-Capability /CapabilityName:NetFx3", + "/Enable-Feature /FeatureName:NetFx3 /All") + +}}{{ +if enableWindowsUpdate:# Enable Windows Update service +sc config wuauserv start= auto ` +}}# Install .NET Fx 3.5 +{{if enableWindowsUpdate:&& }}dism /Online {{dismArgs}}{{ +if enableWindowsUpdate: ` +# Disable Windows Update service +&& sc config wuauserv start= disabled}} \ No newline at end of file diff --git a/eng/dockerfile-templates/runtime/Dockerfile.ltsc2016 b/eng/dockerfile-templates/runtime/Dockerfile.ltsc2016 index 3fc4d663..e6c11f4f 100644 --- a/eng/dockerfile-templates/runtime/Dockerfile.ltsc2016 +++ b/eng/dockerfile-templates/runtime/Dockerfile.ltsc2016 @@ -5,29 +5,23 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2016-amd64 ENV COMPLUS_NGenProtectedProcess_FeatureEnabled=0 RUN ` -{{if PRODUCT_VERSION != "4.6.2" +{{ +if PRODUCT_VERSION != "4.6.2":{{ +if PRODUCT_VERSION = "3.5" +: {{InsertTemplate("Dockerfile.install-netfx3", [], " ")}} ` +^else : # Install .NET Fx {{PRODUCT_VERSION}} powershell -Command ` -{{if PRODUCT_VERSION = "3.5" -: $ErrorActionPreference = 'Stop'; ` -}} $ProgressPreference = 'SilentlyContinue'; ` + $ProgressPreference = 'SilentlyContinue'; ` [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` Invoke-WebRequest ` -UseBasicParsing ` -{{if PRODUCT_VERSION = "3.5" -: -Uri https://dotnetbinaries.blob.core.windows.net/dockerassets/microsoft-windows-netfx3-ltsc2016.zip ` - -OutFile microsoft-windows-netfx3.zip; ` - Expand-Archive microsoft-windows-netfx3.zip; ` - && del microsoft-windows-netfx3.zip ` - && dism /Online /Quiet /Add-Package /PackagePath:C:\microsoft-windows-netfx3\microsoft-windows-netfx3-ondemand-package.cab ` - && rmdir /S /Q microsoft-windows-netfx3 ` -^else -: -Uri {{VARIABLES[cat(PRODUCT_VERSION, "|url")]}} ` + -Uri {{VARIABLES[cat(PRODUCT_VERSION, "|url")]}} ` -OutFile dotnet-framework-installer.exe ` && start /w .\dotnet-framework-installer.exe /q ` && del .\dotnet-framework-installer.exe ` -}} && powershell Remove-Item -Force -Recurse ${Env:TEMP}\* ` - ` + && powershell Remove-Item -Force -Recurse ${Env:TEMP}\* ` +}} ` # Apply latest patch && powershell -Command ` $ProgressPreference = 'SilentlyContinue'; ` diff --git a/src/runtime/3.5/windowsservercore-ltsc2016/Dockerfile b/src/runtime/3.5/windowsservercore-ltsc2016/Dockerfile index c684f0a1..c9bb3837 100644 --- a/src/runtime/3.5/windowsservercore-ltsc2016/Dockerfile +++ b/src/runtime/3.5/windowsservercore-ltsc2016/Dockerfile @@ -5,20 +5,12 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2016-amd64 ENV COMPLUS_NGenProtectedProcess_FeatureEnabled=0 RUN ` + # Enable Windows Update service + sc config wuauserv start= auto ` # Install .NET Fx 3.5 - powershell -Command ` - $ErrorActionPreference = 'Stop'; ` - $ProgressPreference = 'SilentlyContinue'; ` - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` - Invoke-WebRequest ` - -UseBasicParsing ` - -Uri https://dotnetbinaries.blob.core.windows.net/dockerassets/microsoft-windows-netfx3-ltsc2016.zip ` - -OutFile microsoft-windows-netfx3.zip; ` - Expand-Archive microsoft-windows-netfx3.zip; ` - && del microsoft-windows-netfx3.zip ` - && dism /Online /Quiet /Add-Package /PackagePath:C:\microsoft-windows-netfx3\microsoft-windows-netfx3-ondemand-package.cab ` - && rmdir /S /Q microsoft-windows-netfx3 ` - && powershell Remove-Item -Force -Recurse ${Env:TEMP}\* ` + && dism /Online /Enable-Feature /FeatureName:NetFx3 /All ` + # Disable Windows Update service + && sc config wuauserv start= disabled ` ` # Apply latest patch && powershell -Command ` diff --git a/src/runtime/3.5/windowsservercore-ltsc2019/Dockerfile b/src/runtime/3.5/windowsservercore-ltsc2019/Dockerfile index d7a7128c..5c6ca8aa 100644 --- a/src/runtime/3.5/windowsservercore-ltsc2019/Dockerfile +++ b/src/runtime/3.5/windowsservercore-ltsc2019/Dockerfile @@ -5,13 +5,12 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2019-amd64 ENV COMPLUS_NGenProtectedProcess_FeatureEnabled=0 RUN ` + # Enable Windows Update service + sc config wuauserv start= auto ` # Install .NET Fx 3.5 - curl -fSLo microsoft-windows-netfx3.zip https://dotnetbinaries.blob.core.windows.net/dockerassets/microsoft-windows-netfx3-ltsc2019.zip ` - && tar -zxf microsoft-windows-netfx3.zip ` - && del /F /Q microsoft-windows-netfx3.zip ` - && dism /Online /Quiet /Add-Package /PackagePath:.\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab ` - && del microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab ` - && powershell Remove-Item -Force -Recurse ${Env:TEMP}\* ` + && dism /Online /Enable-Feature /FeatureName:NetFx3 /All ` + # Disable Windows Update service + && sc config wuauserv start= disabled ` ` # Apply latest patch && curl -fSLo patch.msu https://catalog.s.download.windowsupdate.com/d/msdownload/update/software/secu/2024/12/windows10.0-kb5049608-x64_1a94518425035b7c11ccd554c89ae09752db511c.msu ` diff --git a/src/runtime/3.5/windowsservercore-ltsc2022/Dockerfile b/src/runtime/3.5/windowsservercore-ltsc2022/Dockerfile index 6f4e6a93..1d5ed02b 100644 --- a/src/runtime/3.5/windowsservercore-ltsc2022/Dockerfile +++ b/src/runtime/3.5/windowsservercore-ltsc2022/Dockerfile @@ -9,12 +9,7 @@ ENV ` RUN ` # Install .NET Fx 3.5 - curl -fSLo microsoft-windows-netfx3.zip https://dotnetbinaries.blob.core.windows.net/dockerassets/microsoft-windows-netfx3-ltsc2022.zip ` - && tar -zxf microsoft-windows-netfx3.zip ` - && del /F /Q microsoft-windows-netfx3.zip ` - && dism /Online /Quiet /Add-Package /PackagePath:.\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab ` - && del microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab ` - && powershell Remove-Item -Force -Recurse ${Env:TEMP}\* ` + dism /Online /Add-Capability /CapabilityName:NetFx3 ` ` # Apply latest 3.5 patch && curl -fSLo patch.msu https://catalog.s.download.windowsupdate.com/d/msdownload/update/software/secu/2024/12/windows10.0-kb5049617-x64-ndp48_5adfae2ccbb4743d93898ff35010c77daa8f130f.msu `