Search code examples
visual-studiomsbuildappveyor

Why does AppVeyor use VS2010 tools for VS2015 image?


We are a C++ library. We are struggling with AppVeyor and Visual Studio build images with x64 builds. Visual Studio build images for Win32 suffer the same problem, but for some [unknown] reason, they complete successfully.

We are attempting to use the Visual Studio 2015 build image (among others):

enter image description here

When we inspect the command line, it appears we are using the Visual Studio 2010 compiler (Visual Studio 10.0 is VS2010):

enter image description here

Our AppVeyor configuration file is located at Noloader GitHub | .appveyor.yml. It is also shown below.

Everything is driven through .appveyor.yml. There are no hidden settings that are affecting things (or we don't believe so). We want everything in .appveyor.yml so people can clone it and things "just work" for them.

The project files are located in GitHub at cryptest.vcxproj and cryptlib.vcxproj. The *.vcxproj files use a hard-coded $(DefaultPlatformToolset) as suggested by @stinj. (EDIT: DefaultPlatformToolset - not anymore. We completely removed DefaultPlatformToolset and PlatformToolset).

The build results for the project are located at Noloader AppVeyor | cryptopp. Its the source of the screen captures.

Why are the wrong build tools being used, and how do we fix it?


When I avoid $(DefaultPlatformToolset) and hard code the the value of the platform toolset, it causes yet another error. For example, below is for the Visual Studio 2015 build image. It dies when the toolset version is set to v140, which is the VS2015 version value. It is befuddling.

(Commit ac513c06f8c8 was eventually reverted because it broke things worse than before).

enter image description here


When we completely remove all traces of PlatformToolset and DefaultPlatformToolset in our VCXPROJ files, it results in the same error. Below is from a Visual Studio 2017 build image.

enter image description here


version: 1.0.{build}
clone_depth: 3

configuration:

- Debug
- Release

platform:

- Win32
- x64

image:

- Visual Studio 2017
- Visual Studio 2015
- Visual Studio 2013

build: off   

test_script:

- cmd: >-   

    msbuild /t:Build /p:platform=%platform%;configuration=%configuration% cryptlib.vcxproj

    msbuild /t:Build /p:platform=%platform%;configuration=%configuration% cryptest.vcxproj

    msbuild /t:CopyCryptestToRoot cryptest.vcxproj

    cryptest.exe v

    cryptest.exe tv all

matrix:

  exclude:
#    - platform: x64
#      configuration: Debug
#    - platform: x64
#      configuration: Release
    - image: Visual Studio 2010
    - image: Visual Studio 2017

notifications:
    - provider: Email
      to:
        - cryptopp-build@googlegroups.com
      on_build_success: true
      on_build_failure: true

Solution

  • Here is how I made it work:

    • Set ToolsVersion="$(ToolsVersion)" and <PlatformToolset>$(TOOLSET)</PlatformToolset> in both .vcxproj files

    • Add Environment variables TOOLSET with value v140 and ToolsVersion with value 14.0

    To achieve all combinations you need with different variables you can use build matrix and avoid combinations you do not need with exclude configuration from the matrix.

    UPDATE: Matrix sample

    image:
    - Visual Studio 2015
    - Visual Studio 2013
    platform:
    - x64
    - x86
    environment:
      matrix:
      - TOOLSET: v140
        ToolsVersion: 14.0
      - TOOLSET: v100
        ToolsVersion: 4.0
    matrix:
      exclude:
        - image: Visual Studio 2015
          TOOLSET: v100
          ToolsVersion: 4.0
        - image: Visual Studio 2013
          TOOLSET: v140
          ToolsVersion: 14.0