Visual studio 2017 paths and vcvars.bat setup

john's Avatar

john

28 May, 2017 08:26 AM

Hi, I'm trying to get appveyor testing support better integrated into the Boost C++ libraries project (and I notice you have our release installed by default - many thanks for that!), at present I have pretty much everything I need working, except Visual Studio 2017. The primary issue is that Microsoft have removed all the environment variables and registry values which were previously used to identify Visual Studio's location, and that in turn has broken our built-in build configuration unless you already *know* what all the relevant paths are, or can start a VS shell from the start menu. This is obviously much harder on a remote machine about which we know little - and I accept there's a limit to just how much you can document! So now for the questions:

* I see from previous answers that 2017 has "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat", good. But I can only invoke from your "Visual Studio 2017" images, so I need to handle both possible image types in the yml file. So I have:

environment:
  matrix:
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
      ARGS: --toolset=msvc-14.1 address-model=64
    - ARGS: --toolset=msvc-9.0 address-model=32
etc

In the yml file, then I use:

test_script:
  - >
    if %APPVEYOR_BUILD_WORKER_IMAGE% == "Visual Studio 2017" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"

But this leads to:

if %APPVEYOR_BUILD_WORKER_IMAGE% == "Visual Studio 2017" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
Studio was unexpected at this time.
Command exited with code 255

In the build log, and fails for both VS2017 and VS2015 images :(

Annoyingly this same command works fine for me if I paste it into a local command prompt. So:

* Any ideas what's wrong with the above command?
* Where is vcvarsall.bat located in your VS2017 tree?
* Ultimately, I'd like the location of cl.exe (and yes I realise there are multiple copies, but once we have one - say the amd64 variant located - our build system can configure itself from there.

BTW, is there any reason not to install VS2017 on the VS2015 images - the different versions can happily coexist - having some "tweak" variables that result in vcvarsall.bat being invoked with a chosen argument would save a lot of hassle figuring this stuff out as well, something like:

APPVEYOR_VS2017_PROMPT: amd64

To have vcvarsall.bat already called with "amd64" as the argument.

Apologies for the long message, and thanks in advance, John Maddock..

  1. 1 Posted by Ilya Finkelshte... on 28 May, 2017 10:26 AM

    Ilya Finkelshteyn's Avatar

    Hi John,

    Please check this discussion, I believe this solves pretty much the same problem.

    Please let us know if this helps.

    Ilya.

  2. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:17 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac