【问题标题】:Deploy x86 and x64 artifacts to AppVeyor on Github Releases在 Github Releases 上将 x86 和 x64 工件部署到 AppVeyor
【发布时间】:2018-11-11 12:27:05
【问题描述】:

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

我希望 AppVeyor 为 x86x64构建 并在 GitHub Releases部署 2 个可执行文件。

虽然只为一个拱门部署似乎可以正常工作,但我发现我的appveyor.yml 文件会在一个作业完成并且另一个开始时替换可执行文件。

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

这是Github Releaseshttps://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

【问题讨论】:

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


    【解决方案1】:

    我想通了!

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

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

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

    关键是可执行文件有不同的文件名

    现在我推送一个新标签,一切正常。

    这是我更新的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
    

    【讨论】:

    • 你也可以用一行- path: Build\Release\pathfinding-$(platform).exe简化artifacts
    • @xorz57,感谢您在这里分享您的解决方案,您可以Accept it as an Answer。这可能对阅读此线程的其他社区成员有益,我们可以关闭此线程。
    • @LeoLiu-MSFT 我很高兴听到这个消息。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-12
    • 2011-08-23
    相关资源
    最近更新 更多