简体   繁体   中英

Docker on Windows Server 2016 & microsoft-build-tools

There is something that does not make sense in choco package microsoft-build-tools version 15.0.26228.0 in combination with Docker on Windows Server 2016:

Using following Dockerfile:

# Adopted from http://blog.alexellis.io/3-steps-to-msbuild-with-docker/  
FROM microsoft/dotnet-framework:4.6.2  
SHELL ["powershell"]  

# Install Chocolatey  
RUN Set-ExecutionPolicy Bypass  
RUN iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))  
# Install dotnet 4.6.2  
RUN choco install netfx-4.6.2-devpack -y  

# Install MSBuild 15.0  
RUN choco install microsoft-build-tools -y  

CMD ["powershell"]  

The logs, both docker and choco indicate success, but inside the container ./Program Files (x86)/Microsoft Visual Studio/2017 folder has not been created and msbuild.exe has not be extracted.

If, inside the container, I reinstall the microsoft-build-tools using choco: the folder is created and image is ready to build .net 4.6.2 code.

Any ideas/thoughts?

I have ended up installing the build tool on the workstation and adding it to the image using copy command (not sure it is allowed to distribute msbuild):

https://github.com/vkhazin/dotnet462-build/blob/master/Dockerfile

I ran into the same issue today. I didn't have any problems with my last project which required dotnet 3.5. This led me to my workaround.

When I based my new image on dotnet-framework:3.5 microsoft-build-tools install fine. If I use dotnet-framework:4.6.2 or dotnet-framework:4.7 nothing shows up.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM