在Github Releases上将x86和x64工件部署到AppVeyor

时间:2018-06-01 11:10:39

标签: visual-studio deployment msbuild continuous-integration appveyor

我有一个Visual Studio 2017解决方案,它由一个C ++项目组成。

我希望AppVeyor能够x86x64以及部署 GitHub Releases上的2个可执行文件构建

虽然仅针对一个arch进行部署似乎工作正常,但我发现我的appveyor.yml文件在作业完成后会替换可执行文件,而另一个文件会启动。

为了记录,这是我的第一次部署,所以我需要一些指导。

以下是Github Releases https://www.appveyor.com/docs/deployment/github/

的一些信息

这是我的appveyor.yml文件

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

1 个答案:

答案 0 :(得分:1)

我明白了!

顺便说一下,这是我的存储库:https://github.com/xorz57/pathfinding

问题是我的visual studio构建树。 如果使用默认的visual studio项目属性,则可执行文件具有完全相同的文件名,即使它们在为x86x64构建时位于不同的目录中,这就是为什么appveyor从未上传的原因GitHub Releases的第二个可执行文件。所以我去了visual studio并打开了我的项目设置来更改构建树。

enter image description here

确保将配置更改为All Configurations,将平台更改为All Platforms。然后继续更改以下三个选项Output DirectoryIntermediate DirectoryTarget Name。在上图中,我将向您展示我如何配置自己的项目。当然,这不是唯一的方式,我也不建议这是组织项目的最好方法。

重点是可执行文件的文件名不同

现在我推出一个新标签,一切都按预期工作。

enter image description here

这是我更新的appveyor.yml文件

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