首页 > 解决方案 > 使用 Github Actions 构建多个 Visual Studio 解决方案

问题描述

我正在尝试使用 Github Actions 构建几个解决方案。我正在使用矩阵策略,因为我需要在 x64 和 x86 中为 Release 和 Debug 构建,但是,我找不到如何使用通配符来构建多个解决方案。我目前有这个:

jobs:
samples-build-VS-2019:
runs-on: windows-2019

strategy:
  matrix:
    configuration: [Release, Debug]
    platform: [x86, x64]

steps:
  - uses: actions/checkout@v2

  - name: Setup MSBuild.exe
    uses: microsoft/setup-msbuild@v1.0.3
  
  - name: Use NuGet 5.2.0
    uses: nuget/setup-nuget@v1

  - name: Restore nuget packages for all solutions
    run: msbuild 'Samples/**/*.sln' /p:configuration=${{ matrix.configuration }} /p:platform=${{ matrix.platform }} /t:restore
  
  - name: Build all Sample solutions
    run: msbuild 'Samples/**/*.sln' /p:configuration=${{ matrix.configuration }} /p:platform=${{ matrix.platform }}

不幸的是,这给了我一个“MSBUILD:错误 MSB1009:项目文件不存在”。错误。甚至有可能做到这一点吗?我需要这样做,因为我需要 CI 在添加新解决方案/项目以及现有解决方案的拉取请求上运行。

标签: visual-studiomsbuildyamlgithub-actions

解决方案


推荐阅读