none
Code Analysis for C++ is not working on Windows container RRS feed

  • Question

  • I got following error when compiling a C++ project with Build Tools 2017 in Windows container “windowservercore”.

    Running Code Analysis for C/C++...
    
    c1xx : error C2220: warning treated as error - no 'object' file generated [C:\jenkins\workspace\ABC-DEV\ABC\ABC.vcxproj]
    
    c1xx : fatal error C1250: Unable to load plug-in 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\localespc.dll'. [C:\jenkins\workspace\ABC-DEV\ABC\ABC.vcxproj]

    Building it with same build tools and workloads on Win10 does not have this problem.
    localespc.dll is actually present under ‘C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin’ in container.

    How to resolve this error? Thanks.

    Compile script:

    call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
    
    "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe"  C:\Work\ABC.sln /p:configuration=Release /p:platform=x64 /t:rebuild

    dockerfile of the image to reproduce this error.
    

    
    
    FROM mcr.microsoft.com/windows/servercore:ltsc2019
    ENV TEMP_DIR="c:/temp"
    SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
    # Create temp file for installers
    RUN New-Item -ItemType Directory -Force -Path $env:TEMP_DIR; 
    # Install build tool for VS 2017 
    SHELL ["cmd", "/S", "/C" ]
    COPY ./BuildTools2017 "$TEMP_DIR/BuildTools2017"
    RUN C:\temp\BuildTools2017\vs_buildtools_2017.exe --quiet --wait --norestart --nocache --noWeb \
         --add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools \
         --add Microsoft.VisualStudio.Workload.VCTools \
         --add Microsoft.Net.Component.3.5.DeveloperTools \
         --add Microsoft.VisualStudio.Component.Windows10SDK.17763
    SHELL ["powershell", "-NoProfile", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; "]
    RUN dir "$env:TEMP_DIR" | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
    # Install WDK 10 1703
    COPY ./WDK1703 "$TEMP_DIR/WDK1703"
    RUN \
        Start-Process -FilePath "$env:TEMP_DIR/WDK1703/wdksetup.exe" -ArgumentList '/q', '/norestart' -PassThru | Wait-Process;
    RUN dir "$env:TEMP_DIR" | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
    # Install WDK 10 1809
    COPY ./WDK1809 "$TEMP_DIR/WDK1809"
    RUN \
        Start-Process -FilePath "$env:TEMP_DIR/WDK1809/wdksetup.exe" -ArgumentList '/q', '/norestart' -PassThru | Wait-Process;
    RUN dir "$env:TEMP_DIR" | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
    # Install VCRedist 2012 
    COPY ./VCRedist "$TEMP_DIR/VCRedist"
    RUN \
        Start-Process -FilePath "$env:TEMP_DIR/VCRedist/vcredist_x64_2012.exe" -ArgumentList '/passive', '/norestart' -PassThru | Wait-Process;
    COPY ./ABC "C:/ABC"



    Tuesday, July 30, 2019 9:02 AM

All replies

  • Greetings,

    Do you have a chance to try mcr.microsoft.com/windows:1903 ?


    Sic Parvis Magna

    Wednesday, July 31, 2019 1:27 AM
  • Docker pull mcr.microsoft.com/windows:1903

    No matching manifest for unknown in the manifest list entries.

    Wednesday, July 31, 2019 9:06 AM
  • FROM mcr.microsoft.com/windows/servercore:ltsc2019
    
    ENV TEMP_DIR="c:/temp"
    
    SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
    
    # Create temp file for installers
    RUN New-Item -ItemType Directory -Force -Path $env:TEMP_DIR; 
    
    # Install build tool for VS 2017 
    SHELL ["cmd", "/S", "/C" ]
    COPY ./BuildTools2017 "$TEMP_DIR/BuildTools2017"
    RUN C:\temp\BuildTools2017\vs_buildtools_2017.exe --quiet --wait --norestart --nocache --noWeb \
          --add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools \
          --add Microsoft.VisualStudio.Workload.VCTools \
          --add Microsoft.Net.Component.3.5.DeveloperTools \
          --add Microsoft.VisualStudio.Component.Windows10SDK.17763
    SHELL ["powershell", "-NoProfile", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; "]
    
    RUN dir "$env:TEMP_DIR" | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
    
    # Install VCRedist 2012 
    COPY ./VCRedist2012 "$TEMP_DIR/VCRedist2012"
    RUN \
       Start-Process -FilePath "$env:TEMP_DIR/VCRedist2012/vcredist_x64_2012.exe" -ArgumentList '/passive', '/norestart' -PassThru | Wait-Process;
    
    COPY ./TinyCMD "C:/temp/TinyCMD"

    call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86
    
    "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe"  C:\Temp\TinyCMD\CMDUI.sln /p:configuration=Release /p:platform=Win32 /t:rebuild

    C++ project "TinyCMD" download link:

    https://1drv.ms/u/s!Ap_EAuwC9QkXgh8lIGIqM2qtPRq1?e=vDQtKl

    I can reproduce the error C1250 using above environment, no WDKs and ADKs installed.

    Monday, August 19, 2019 7:48 AM