0

We have Docker installed on Windows Server 2016. The application we have is in .NET 5.0 using VS 2019 IDE. I couldn't get Docker container up and running using below code. The installation of VS 2019 build tools fails. Any help is highly appreciated.

Things I tried:

  1. Installing .NET 5.0 (sdk/runtime) seems to be successful but the dotnetfx (exit code 3010) requires reboot which is the root cause. Because of this pending reboot, the installation of VS 2019 build tools fails.
  2. I tried using other images but getting daemon related error. Looks like I am unable to find Docker image which has .NET 5.0 installed for windows server 2016 host

DockerFile:

# escape=`
FROM mcr.microsoft.com/windows/servercore:1607
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]


# Install Chocolatey
RUN write-host "*********** Chocolatey Install"
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))


# Install Nuget
RUN write-host "*********** NuGet Install"
RUN choco install nuget.commandline --version=5.11.0


# Install .net 5.0 framework
# RUN write-host "*********** Install .Net 5.0"
RUN choco install dotnet-5.0-sdk --version=5.0.402 --yes


# Download and Install Build Tools
RUN write-host "*********** Download and Install Build Tools 2019"
RUN choco install visualstudio2019buildtools --version=16.11.5.0 --yes

Error:

Installed:

  • dotnetfx v4.8.0.20190930
  • chocolatey-visualstudio.extension v1.10.0
  • visualstudio-installer v2.0.2
  • chocolatey-dotnetfx.extension v1.0.1

Packages requiring reboot:

  • dotnetfx (exit code 3010)

The recent package changes indicate a reboot is necessary. Please reboot at your earliest convenience.

Failures

  • visualstudio2019buildtools (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\visualstudio2019buildtools\tools\ChocolateyInstall.ps1'.

1 Answer 1

2

I don't know how choco handles the installation of VS Build Tools so I can't say for sure how to avoid the restart requirement.

However, you should be able to avoid creating your own image and instead use the existing mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2016 image. This actually provides everything you need:

Sign up to request clarification or add additional context in comments.

8 Comments

Thanks @MattThalman I used that image but I am get following error when trying to build/publish... C:\Program Files\dotnet\sdk\2.2.402\Microsoft.Common.CurrentVersion.targets(1175,5): error MSB3644: The reference assemblies for .NETFramework,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at aka.ms/msbuild/developerpacks
There is no C:\Program Files\dotnet\sdk\2.2.402\Microsoft.Common.CurrentVersion.targets file in that container image. So this is odd. Are you installing other stuff? What does your Dockerfile look like for that scenario? Or are you not running on the latest image for that tag?
So the host has .net core 2.2 installed. May be that's why its picking 2.2 sdk. I ran dotnet --info and dotnet --version and it came back with 2.2 version. I thought may be after installing .net 5.0 it should pick latest/greatest sdk
Installing .NET 5 would cause it to use it by default but could be overridden by a global.json file. But why is your host machine relevant to what's happening in the Dockerfile?
Docker file: ` # escape=` FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2016 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] RUN Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('chocolatey.org/install.ps1')) RUN choco install nodejs --version=10.15.0 -y RUN npm install [email protected] -g RUN npm install [email protected] -g `
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.