在每个平台的传送带中构建不同的解决方案配置

问题描述 投票:0回答:2

我正在尝试将Linux构建和测试添加到我维护的C#库中。解决方案中的一个库需要WinForms,因此无法在Linux上构建。我在解决方案中添加了ReleaseNoGui配置,我希望Linux构建该配置,而不是Release。这可能吗?这是我尝试过的方法,但仍在构建Release

(…)

image: 
  - Visual Studio 2019
  - Ubuntu1804

configuration: Release

(…)

build:
  project: MySolution.sln
  parallel: true
  verbosity: minimal
  publish_nuget: true
  publish_nuget_symbols: false


for:
  - 
    matrix:
      only:
        - image: Visual Studio 2019

    deploy:
      - provider: NuGet
        name: nuget_release
        api_key:
(snipped...)
  -
    matrix:
      only:
        - image: Ubuntu1804

    configuration: ReleaseNoGui

appveyor
2个回答
1
投票

for.matrix专门基于环境变量进行配置。当前,image是不受支持的环境变量。

要实现所需的功能,可以改用以下appveyor.yml配置:

environment:
  matrix:

  # Windows job
  - job_name: Windows build
    appveyor_build_worker_image: Visual Studio 2019

  # Linux job
  - job_name: Linux build
    appveyor_build_worker_image: Ubuntu1804

matrix:
  fast_finish: true

configuration: Release

build:
  project: MySolution.sln
  parallel: true
  verbosity: minimal
  publish_nuget: true
  publish_nuget_symbols: false

for:
-
  matrix:
    only:
      - job_name: Windows build

  deploy:
    - provider: NuGet
      name: nuget
-
  matrix:
    only:
      - job_name: Linux build

  configuration: ReleaseNoGui

0
投票

[阅读完Feodor的答案后,我尝试了environment.matrix,并将configuration添加到environment.matrix项目中,并提出了:]]

environment:
  matrix:

  # Windows job
  - job_name: Windows build
    appveyor_build_worker_image: Visual Studio 2019
    configuration: Release

  # Linux job
  - job_name: Linux build
    appveyor_build_worker_image: Ubuntu1804
    configuration: ReleaseNoGui

matrix:
  fast_finish: true

build:
  project: MySolution.sln
  parallel: true
  verbosity: minimal
  publish_nuget: true
  publish_nuget_symbols: false

for:
-
  matrix:
    only:
      - job_name: Windows build

  deploy:
    - provider: NuGet
      name: nuget

使用正确的配置构建Linux。

© www.soinside.com 2019 - 2024. All rights reserved.