Get-WindowsFeature is not available in mcr.microsoft.com/windows:ltsc2019
sumit84mca opened this issue · 7 comments
What is your question?
I have a C# code that is that using Telerik library. Our code is deployed on mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019 but here it is not working.
We tried that code on mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2022 as well but here it was not also not working.
So I used mcr.microsoft.com/windows/server:ltsc2022 as base image and install all necessary features on this to run a website. After that the code is working on new Image.
Now I am trying to do same with mcr.microsoft.com/windows:ltsc2019. When I am trying to install Windows server features using command Get-WindowsFeature, it is saying that this command is not present.
So I have two questions
- What are the features that are not present in the framework docker images but in server images
- How can I install all required features in mcr.microsoft.com/windows:ltsc2019 to run my net framework/net core applications.
below is the docker file for windows:ltsc2019
# escape=
FROM mcr.microsoft.com/windows:ltsc2019
ENV # Enable detection of running in a container COMPLUS_RUNNING_IN_CONTAINER=1
COMPLUS_NGenProtectedProcess_FeatureEnabled=0
RUN # Install .NET Fx 4.8 curl -fSLo dotnet-framework-installer.exe https://download.visualstudio.microsoft.com/download/pr/2d6bb6b2-226a-4baa-bdec-798822606ff1/8494001c276a4b96804cde7829c04d7f/ndp48-x86-x64-allos-enu.exe
&& .\dotnet-framework-installer.exe /q && del .\dotnet-framework-installer.exe
&& powershell Remove-Item -Force -Recurse ${Env:TEMP}*
# Apply latest patch
&& curl -fSLo patch.msu https://catalog.s.download.windowsupdate.com/c/msdownload/update/software/secu/2023/12/windows10.0-kb5033911-x64-ndp48_fd9c7de7eff3906ed882d2a338030d33ea373ba5.msu && mkdir patch
&& expand patch.msu patch -F:* && del /F /Q patch.msu
&& dism /Online /Quiet /Add-Package /PackagePath:C:\patch\windows10.0-kb5033911-x64-ndp48.cab && rmdir /S /Q patch
# ngen .NET Fx && %windir%\Microsoft.NET\Framework64\v4.0.30319\ngen uninstall "Microsoft.Tpm.Commands, Version=10.0.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=amd64"
&& %windir%\Microsoft.NET\Framework64\v4.0.30319\ngen update `
&& %windir%\Microsoft.NET\Framework\v4.0.30319\ngen update
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN Add-WindowsFeature Web-Server; Add-WindowsFeature NET-Framework-45-ASPNET;
Add-WindowsFeature Web-Asp-Net45; Remove-Item -Recurse C:\inetpub\wwwroot\*;
Invoke-WebRequest -Uri https://dotnetbinaries.blob.core.windows.net/servicemonitor/2.0.1.10/ServiceMonitor.exe -OutFile C:\ServiceMonitor.exe; &$Env:windir\Microsoft.NET\Framework64\v4.0.30319\ngen update;
&$Env:windir\Microsoft.NET\Framework\v4.0.30319\ngen update
RUN Invoke-WebRequest https://api.nuget.org/packages/microsoft.net.compilers.2.9.0.nupkg -OutFile C:\microsoft.net.compilers.2.9.0.zip; Expand-Archive -Path C:\microsoft.net.compilers.2.9.0.zip -DestinationPath C:\RoslynCompilers;
Remove-Item C:\microsoft.net.compilers.2.9.0.zip -Force; &$Env:windir\Microsoft.NET\Framework64\v4.0.30319\ngen install C:\RoslynCompilers\tools\csc.exe /ExeConfig:C:\RoslynCompilers\tools\csc.exe |
&$Env:windir\Microsoft.NET\Framework64\v4.0.30319\ngen install C:\RoslynCompilers\tools\vbc.exe /ExeConfig:C:\RoslynCompilers\tools\vbc.exe | &$Env:windir\Microsoft.NET\Framework64\v4.0.30319\ngen install C:\RoslynCompilers\tools\VBCSCompiler.exe /ExeConfig:C:\RoslynCompilers\tools\VBCSCompiler.exe |
&$Env:windir\Microsoft.NET\Framework\v4.0.30319\ngen install C:\RoslynCompilers\tools\csc.exe /ExeConfig:C:\RoslynCompilers\tools\csc.exe | &$Env:windir\Microsoft.NET\Framework\v4.0.30319\ngen install C:\RoslynCompilers\tools\vbc.exe /ExeConfig:C:\RoslynCompilers\tools\vbc.exe |
&$Env:windir\Microsoft.NET\Framework\v4.0.30319\ngen install C:\RoslynCompilers\tools\VBCSCompiler.exe /ExeConfig:C:\RoslynCompilers\tools\VBCSCompiler.exe
RUN Invoke-WebRequest https://api.nuget.org/packages/microsoft.net.compilers.3.6.0.nupkg -OutFile C:\microsoft.net.compilers.3.6.0.zip; Expand-Archive -Path C:\microsoft.net.compilers.3.6.0.zip -DestinationPath C:\RoslynCompilers-3.6.0;
Remove-Item C:\microsoft.net.compilers.3.6.0.zip -Force; &$Env:windir\Microsoft.NET\Framework64\v4.0.30319\ngen install C:\RoslynCompilers-3.6.0\tools\csc.exe /ExeConfig:C:\RoslynCompilers-3.6.0\tools\csc.exe |
&$Env:windir\Microsoft.NET\Framework64\v4.0.30319\ngen install C:\RoslynCompilers-3.6.0\tools\vbc.exe /ExeConfig:C:\RoslynCompilers-3.6.0\tools\vbc.exe | &$Env:windir\Microsoft.NET\Framework64\v4.0.30319\ngen install C:\RoslynCompilers-3.6.0\tools\VBCSCompiler.exe /ExeConfig:C:\RoslynCompilers-3.6.0\tools\VBCSCompiler.exe |
&$Env:windir\Microsoft.NET\Framework\v4.0.30319\ngen install C:\RoslynCompilers-3.6.0\tools\csc.exe /ExeConfig:C:\RoslynCompilers-3.6.0\tools\csc.exe | &$Env:windir\Microsoft.NET\Framework\v4.0.30319\ngen install C:\RoslynCompilers-3.6.0\tools\vbc.exe /ExeConfig:C:\RoslynCompilers-3.6.0\tools\vbc.exe |
&$Env:windir\Microsoft.NET\Framework\v4.0.30319\ngen install C:\RoslynCompilers-3.6.0\tools\VBCSCompiler.exe /ExeConfig:C:\RoslynCompilers-3.6.0\tools\VBCSCompiler.exe
ENV ROSLYN_COMPILER_LOCATION=C:\RoslynCompilers-3.6.0\tools
EXPOSE 80
ENTRYPOINT ["C:\ServiceMonitor.exe", "w3svc"]`
@ntrappe-msft any update on this. Should I raise it as an Issue?
Hey @sumit84mca, thank you for raising this with us.
We don't ship OS level fixes anymore for Windows Server 2019 because it is now out of mainstream support (only address security fixes): https://learn.microsoft.com/en-us/lifecycle/products/windows-server-2019
OK. I got your point.
Can you guide me to resolve this issue?
Have you tried using the Windows Server Core LTSC 2022 image to install your Windows Server features?
@sumit84mca Pinging this thread again for a response.
Closing issue because it's going stale