我正在尝试使用.net Framework 4.7.2设置Windows Docker映像。 由于其他原因,我从 microsoft / windowsservercore
开始到目前为止我尝试过的 -我在映像上安装了choco,所以最初的解决方法是使用choco install
choco install dotnet4.7.2 --allow-empty-checksums -y -v --trace -d
我得到的是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/
根据上面链接的一些想法,我做了:
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'-递归| Get-ItemProperty -name版本,版本-EA 0 |其中{$ _。PSChildName -match'^(? !S)\ p {L}'} |选择PSChildName,版本,发行版
我的最终目标:我想用目标4.7.2构建一个C#sln解决方案。
我没主意了。 有什么想法吗?
谢谢
答案 0 :(得分:1)
您可以使用与Microsoft相同的dockerfile在此处为SDK(https://github.com/microsoft/dotnet-framework-docker/blob/master/4.7.2/sdk/windowsservercore-ltsc2019/Dockerfile)或运行时(https://github.com/microsoft/dotnet-framework-docker/blob/master/4.7.2/runtime/windowsservercore-ltsc2019/Dockerfile)构建其dotnetframework映像
答案 1 :(得分:0)
如果您确实想在不使用现有映像的情况下执行此操作,则可以创建一个powershell脚本来下载并安装它,然后在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
DockerFile(假设您将脚本命名为InstallNetFramework.ps1,并且它与DockerFile位于同一个文件夹中:
FROM microsoft/windowsservercore
RUN mkdir c:\install
ADD /InstallNetFramework.ps1 c:\install
RUN powershell c:\install\InstallNetFramework.ps1
但是最好使用已经安装了.Net 4.7.2的映像,因为否则:
但是,如果仅执行一次,则可以在自己的个人Container Registry中注册它,并将其用作其他DockerFiles的基础映像(例如,将其用作FROM)