Skip to content

Commit 9d3eb75

Browse files
Add .NET Framework on Windows example (#439)
1 parent b4f0773 commit 9d3eb75

3 files changed

Lines changed: 65 additions & 0 deletions

File tree

dotnet/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# escape=`
2+
3+
FROM mcr.microsoft.com/windows:1809
4+
5+
USER ContainerAdministrator
6+
# Install .NET 4.8
7+
RUN curl -fSLo dotnet-framework-installer.exe https://download.visualstudio.microsoft.com/download/pr/7afca223-55d2-470a-8edc-6a1739ae3252/abd170b4b0ec15ad0222a809b761a036/ndp48-x86-x64-allos-enu.exe `
8+
&& .\dotnet-framework-installer.exe /q `
9+
&& del .\dotnet-framework-installer.exe `
10+
&& powershell Remove-Item -Force -Recurse ${Env:TEMP}\*
11+
12+
# Apply latest patch
13+
RUN curl -fSLo patch.msu http://download.windowsupdate.com/d/msdownload/update/software/secu/2020/05/windows10.0-kb4552930-x64-ndp48_3fb9f9a7b72e49707c8c49b4febc171411eca05f.msu `
14+
&& mkdir patch `
15+
&& expand patch.msu patch -F:* `
16+
&& del /F /Q patch.msu `
17+
&& DISM /Online /Quiet /Add-Package /PackagePath:C:\patch\windows10.0-kb4552930-x64-ndp48.cab `
18+
&& rmdir /S /Q patch
19+
20+
# ngen .NET Fx
21+
ENV COMPLUS_NGenProtectedProcess_FeatureEnabled 0
22+
RUN \Windows\Microsoft.NET\Framework64\v4.0.30319\ngen uninstall "Microsoft.Tpm.Commands, Version=10.0.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=amd64" `
23+
&& \Windows\Microsoft.NET\Framework64\v4.0.30319\ngen update `
24+
&& \Windows\Microsoft.NET\Framework\v4.0.30319\ngen update

dotnet/Dockerfile.orig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# escape=`
2+
3+
FROM mcr.microsoft.com/windows/servercore:ltsc2019
4+
5+
# Install .NET 4.8
6+
RUN curl -fSLo dotnet-framework-installer.exe https://download.visualstudio.microsoft.com/download/pr/7afca223-55d2-470a-8edc-6a1739ae3252/abd170b4b0ec15ad0222a809b761a036/ndp48-x86-x64-allos-enu.exe `
7+
&& .\dotnet-framework-installer.exe /q `
8+
&& del .\dotnet-framework-installer.exe `
9+
&& powershell Remove-Item -Force -Recurse ${Env:TEMP}\*
10+
11+
# Apply latest patch
12+
RUN curl -fSLo patch.msu http://download.windowsupdate.com/d/msdownload/update/software/secu/2020/05/windows10.0-kb4552930-x64-ndp48_3fb9f9a7b72e49707c8c49b4febc171411eca05f.msu `
13+
&& mkdir patch `
14+
&& expand patch.msu patch -F:* `
15+
&& del /F /Q patch.msu `
16+
&& DISM /Online /Quiet /Add-Package /PackagePath:C:\patch\windows10.0-kb4552930-x64-ndp48.cab `
17+
&& rmdir /S /Q patch
18+
19+
# ngen .NET Fx
20+
ENV COMPLUS_NGenProtectedProcess_FeatureEnabled 0
21+
RUN \Windows\Microsoft.NET\Framework64\v4.0.30319\ngen uninstall "Microsoft.Tpm.Commands, Version=10.0.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=amd64" `
22+
&& \Windows\Microsoft.NET\Framework64\v4.0.30319\ngen update `
23+
&& \Windows\Microsoft.NET\Framework\v4.0.30319\ngen update

dotnet/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# .NET Framework on Windows image
2+
3+
This Dockerfile builds a Windows image (the big one, not Windows Server Core) with .NET Framework 4.8.
4+
5+
The Dockerfile is based on https://github.com/microsoft/dotnet-framework-docker/blob/master/4.8/runtime/windowsservercore-ltsc2019/Dockerfile
6+
with a few changes
7+
8+
```diff
9+
3c3
10+
< FROM mcr.microsoft.com/windows/servercore:ltsc2019
11+
---
12+
> FROM mcr.microsoft.com/windows:1809
13+
4a5
14+
> USER ContainerAdministrator
15+
```
16+
17+
The main difference is that the big Windows image has the default user ContainerUser instead of ContainerAdministrator and therefore does not have enough permission to install software.
18+

0 commit comments

Comments
 (0)