Windows Dotnet framework Dockerfile
Published in
1 min readNov 29, 2018
Will provide a windows dotnet framework 4.5.2 dockerfile and can be built on microsoft lstc 2016.
Please find the below dockerfile which can build windows docker image with dotnet4.5.2, VS2017, powershell, Nuget and MS Build
# escape=`FROM microsoft/windowsservercore:ltsc2016SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]RUN Install-PackageProvider -Name chocolatey -RequiredVersion 2.8.5.130 -Force; `Install-Package -Name microsoft-build-tools -RequiredVersion 15.0.26228.0 -Force; `Install-Package -Name netfx-4.5.2-devpack -RequiredVersion 4.5.5165101 -Force; `Install-Package nuget.commandline -RequiredVersion 3.5.0 -Force;ENV NUGET_PATH="C:\Chocolatey\lib\NuGet.CommandLine.3.5.0\tools" `CHOCLATEY_PATH="C:\Chocolatey\bin" `
MSBUILD_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"RUN $env:PATH = $env:NUGET_PATH + ';' + $env:CHOCLATEY_PATH + ';' + $env:MSBUILD_PATH + ';' + $env:PATH; `[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine)ENTRYPOINT ["powershell"]
NOTE: To build windows docker images/run windows containers you need to have same windows operating system with same version.
Error: If you run through the unable to download / reach the server , you might want to check the tls version and add the below line
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
to the first Run
command.