Search code examples
visual-studiodeploymentmsbuildcontinuous-integrationappveyor

Deploy x86 and x64 artifacts to AppVeyor on Github Releases


I have a Visual Studio 2017 solution that consists of a single C++ project.

I wanted AppVeyor to build for x86 and x64 and deploy the 2 executables on GitHub Releases.

While deploying only for one arch seems to work fine I found out that my appveyor.yml file replaces the executable once a job finishes and another starts.

For the record, this is my first deployment ever so I would need some guidance.

Here is some info on Github Releases https://www.appveyor.com/docs/deployment/github/

Here is my appveyor.yml file

version: '{build}'
image: Visual Studio 2017
configuration: Release
platform:
- x86
- x64
build:
  verbosity: minimal
artifacts:
- path: Release\pathfinding.exe
  name: pathfinding-x86.exe
- path: x64\Release\pathfinding.exe
  name: pathfinding-x64.exe
deploy:
- provider: GitHub
  auth_token:
    secure: the-token-is-hidden-on-purpose
  force_update: true
  on:
    APPVEYOR_REPO_TAG: true

Solution

  • I figured it out!

    Here is my repository by the way: https://github.com/xorz57/pathfinding

    The problem was my visual studio build tree. If you use the default visual studio project properties the executable files have the exact same filename even though they are on a different directory when you build for x86 and x64 and that's why appveyor never uploaded a second executable to GitHub Releases. So I went to visual studio and opened up my project settings to change the build tree.

    enter image description here

    Make sure to change Configuration to All Configurations and Platform to All Platforms. Then proceed to change the following three options Output Directory, Intermediate Directory, Target Name. In the picture above I show you how I configured my own project. Of course this is not the only way nor I am suggesting this is the best prossible way to organize your project.

    The point is to have different filename for the executable files.

    Now I push a new tag and everything works as intended.

    enter image description here

    And here is my updated appveyor.yml file

    version: '{build}'
    image: Visual Studio 2017
    configuration: Release
    platform:
    - x86
    - x64
    build:
      parallel: true
      verbosity: minimal
    artifacts:
    - path: Build\Release\pathfinding-x86.exe
      name: pathfinding-x86.exe
    - path: Build\Release\pathfinding-x64.exe
      name: pathfinding-x64.exe
    deploy:
    - provider: GitHub
      auth_token:
        secure: the-token-is-hidden-on-purpose
      force_update: true
      on:
        APPVEYOR_REPO_TAG: true