Skip to content

VS 2017 not found inside Windows Docker container

I setting up Docker as build server with Visual Studio 2017. Everything work fine until we added CMake into equation and our builds.

In my Dockerfile i have installed Cmake and Visual Studio 2017 with all dependencies we need. When we come to stage where we going to build or CMake it crasch with this message:

PS C:\> cmake -G"Visual Studio 15 2017 Win64" -B"C:/agent/_work/1/s\src/clients/xxx/build/Windows/" -H"C:/agent/_work/1/
s\src/clients/xxx/"
CMake Error at CMakeLists.txt:18 (project):
  Generator

    Visual Studio 15 2017 Win64

  could not find any instance of Visual Studio.
  • Installed Cmake in Visual Studio as addin and also on buildserver installed SYSTEM wide. 3.13

How do CMake find Visual Studio generator? I havent found anything regarding this issue.

Dockerfile

FROM microsoft/dotnet-framework:4.7.2-sdk-20190108-windowsservercore-ltsc2016
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV chocolateyUseWindowsCompression=false
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

ADD dotnet-install.ps1 dotnet-install.ps1
RUN .\dotnet-install.ps1 -Version 2.1.4

ADD vs_enterprise.exe vs_enterprise.exe

RUN ./vs_enterprise.exe --wait --quiet --allWorkloads --includeRecommended  \
    --add Microsoft.VisualStudio.Workload.ManagedDesktop \
    --add Microsoft.VisualStudio.Workload.NativeDesktop \
    --add Microsoft.VisualStudio.Workload.Universal \
    --add Microsoft.VisualStudio.Workload.NetWeb \
    --add Microsoft.VisualStudio.Workload.Azure \
    --add Microsoft.VisualStudio.Workload.Node \
    --add Microsoft.VisualStudio.Workload.NetCrossPlat \
    --add Microsoft.VisualStudio.Workload.WebCrossPlat \
    --add Microsoft.VisualStudio.Workload.VisualStudioExtension \
    --add Microsoft.VisualStudio.Workload.NetCoreTools \
    --add microsoft.net.componentgroup.targetingpacks.common \
    --add microsoft.visualstudio.component.entityframework \
    --add microsoft.visualstudio.component.debugger.justintime \
    --add microsoft.visualstudio.component.liveunittesting \
    --add microsoft.net.component.4.7.sdk \
    --add microsoft.net.component.4.7.targetingpack \
    --add microsoft.net.component.4.7.1.sdk \
    --add microsoft.net.component.4.7.1.targetingpack \
    --add microsoft.visualstudio.component.wcf.tooling \
    --add microsoft.visualstudio.componentgroup.architecturetools.managed \
    --add microsoft.visualstudio.component.vc.diagnostictools \
    --add microsoft.visualstudio.component.vc.cmake.project \
    --add microsoft.visualstudio.component.vc.testadapterforgoogletest \
    --add microsoft.component.vc.runtime.ucrtsdk \
    --add microsoft.visualstudio.component.windows81sdk \
    --add microsoft.visualstudio.component.vc.atlmfc \
    --add microsoft.visualstudio.component.vc.cli.support \
    --add microsoft.visualstudio.component.windows10sdk.16299.desktop \
    --add microsoft.visualstudio.component.windows10sdk.15063.desktop \
    --add microsoft.visualstudio.component.windows10sdk.14393 \
    --add microsoft.visualstudio.component.windows10sdk.10586 \
    --add microsoft.visualstudio.component.windows10sdk.10240 \
    --add microsoft.visualstudio.component.vc.140 \
    --add microsoft.visualstudio.component.webdeploy \
    --add microsoft.visualstudio.web.mvc4.componentgroup \
    --add microsoft.netcore.componentgroup.web \
    --add microsoft.visualstudio.component.testtools.webloadtest \
    --add microsoft.component.azure.datalake.tools \
    --add microsoft.visualstudio.componentgroup.azure.resourcemanager.tools \
    --add microsoft.visualstudio.componentgroup.azure.cloudservices \
    --add microsoft.visualstudio.component.azure.mobileappssdk \
    --add microsoft.visualstudio.component.azure.servicefabric.tools \
    --add microsoft.visualstudio.component.teamoffice \
    --add component.xamarin.inspector \
    --add component.xamarin.profiler \
    --add microsoft.visualstudio.component.git \
    --add component.android.ndk.r13b \
    --add component.google.android.emulator.api25 \
    --add microsoft.visualstudio.component.testtools.feedbackclient \
    --add microsoft.visualstudio.component.testtools.microsofttestmanager \
    --add microsoft.visualstudio.component.typescript.2.8 \
    --add component.android.emulator \
    --add component.wixtoolset.visualstudioextension.dev15

RUN choco install \
    cmake \
    --confirm \
    --installargs 'ADD_CMAKE_TO_PATH=System' \
    --version 3.13.3 \
    --limit-output \
    --timeout 216000
Edited by Tobias Larsson
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information