我试图将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
答案 0 :(得分: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
答案 1 :(得分:0)
在阅读了Feodor的答案之后,我尝试了module_that_contains_function_to_be_mocked
,并将environment.matrix
添加到configuration
项目中,并得出:
environment.matrix
以正确的配置构建Linux。