I am trying to setup a Windows Docker image with .net framework 4.7.2. For other reasons, I am starting from microsoft/windowsservercore
What I tried so far - I have choco installed on my image, so my initial solution was to use choco install
choco install dotnet4.7.2 --allow-empty-checksums -y -v --trace -d
What I get is 0x80004005
C:\users\ContainerAdministrator\AppData\Local\Temp\chocolatey> more .\dd_NDP472-KB4054530-x86-x64-AllOS-ENU_decompression_log.txt
??[5/25/2019, 22:26:33] === Logging started: 2019/05/25 22:26:33 ===
[5/25/2019, 22:26:33] Executable: C:\Users\ContainerAdministrator\AppData\Local\Temp\chocolatey\dotnetfx\4.7.2.20180712\NDP472-KB4054530-x86-x64-AllOS-ENU.exe v4.7.3081.0
[5/25/2019, 22:26:33] --- logging level: standard ---
[5/25/2019, 22:26:33] Successfully bound to the ClusApi.dll
[5/25/2019, 22:26:33] Error 0x800706d9: Failed to open the current cluster
[5/25/2019, 22:26:33] Cluster drive map: ''
[5/25/2019, 22:26:33] Considering drive: 'C:\'...
[5/25/2019, 22:26:33] Drive 'C:\' has been selected as the largest fixed drive
[5/25/2019, 22:26:33] Directory 'C:\b659e2a87b51ccf0f10d6292d1a4c2\' has been selected for file extraction
[5/25/2019, 22:26:33] Extracting files to: C:\b659e2a87b51ccf0f10d6292d1a4c2\
[5/25/2019, 22:26:33] Error 0x80004005: Failed to extract all files out of box container #0.
[5/25/2019, 22:26:33] Error 0x80004005: Failed to extract
https://blog.nowmicro.com/2015/02/23/deploying-net-framework-4-5-2-configmgr-application/
Following some the ideas from links above, I did :
docker run --name cw10 -v C:\MyNDP472:C:\tmp -d client-windows10
Setup.exe /q /norestart /ChainingPackage "ADMINDEPLOYMENT" /x86 /x64 /redist /log "C:\tmp\reportdotnet.log"
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse |Get-ItemProperty -name Version,Release -EA 0 |Where { $_.PSChildName -match '^(?!S)\p{L}'} |Select PSChildName, Version, Release
My final goal : I want to build a C# sln solution with target 4.7.2.
I am out of ideas. Any thought?
Thanks
You can use the same dockerfile which microsoft using for building their dotnetframework images here for SDK (https://github.com/microsoft/dotnet-framework-docker/blob/master/4.7.2/sdk/windowsservercore-ltsc2019/Dockerfile) or runtime (https://github.com/microsoft/dotnet-framework-docker/blob/master/4.7.2/runtime/windowsservercore-ltsc2019/Dockerfile)
If you really want to do this without using an existing image, then you could create a powershell script to download and install it, and then call this from within your dockerfile:
Write-Host ".Net 4.7.2 not installed. Downloading..."
Invoke-WebRequest "http://go.microsoft.com/fwlink/?linkid=863265" -OutFile "NDP472-KB4054530-x86-x64-AllOS-ENU.exe"
Write-Host "Installing .Net 4.7.2..."
$exe = ".\NDP472-KB4054530-x86-x64-AllOS-ENU.exe"
&$exe /q /norestart
The DockerFile (assuming you name your script InstallNetFramework.ps1 and it lives in the same folder as your DockerFile:
FROM microsoft/windowsservercore
RUN mkdir c:\install
ADD /InstallNetFramework.ps1 c:\install
RUN powershell c:\install\InstallNetFramework.ps1
But you are probably best using an image that already has .Net 4.7.2 installed because otherwise:
If you just do this once however, you could register this in your own personal Container Registry and use it as your base image for further DockerFiles (e.g. use this as the FROM)
User contributions licensed under CC BY-SA 3.0