【发布时间】:2020-05-25 00:25:06
【问题描述】:
我有通过 Azure Pipelines 构建的复杂 C# 解决方案。
这是一个 MonoGame v3.7.1 项目,其中包含我在公共 GitHub 存储库中托管的多个项目。解决方案结构如下所示:
- AzureTest
- AzureTest.Core
- AzureTest.DirectX
- AzureTest.OpenGL
Core 项目是共享项目,无法运行,而 DirectX 和 OpenGL 都引用了 .Core,可以运行。所有游戏代码都将存在于 Core 项目中。
我当前的 azure-pipelines.yml 配置文件如下所示:
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
branches:
include:
- '*'
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'x86'
buildConfiguration: 'Release'
monoGameVersion: 'v3.7.1'
steps:
- task: GitVersion@5
inputs:
runtime: 'full'
updateAssemblyInfo: true
configFilePath: 'gitversion.yml'
- script: |
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://github.com/MonoGame/MonoGame/releases/download/$(monoGameVersion)/MonoGameSetup.exe', '.\MonoGameSetup.exe')"
displayName: 'Download MonoGame $(monoGameVersion)'
- task: ExtractFiles@1
inputs:
archiveFilePatterns: 'MonoGameSetup.exe'
destinationFolder: './tmp/'
displayName: 'Extract MonoGame $(monoGameVersion)'
- script: |
mkdir "%PROGRAMFILES(X86)%\MSBuild"
xcopy .\tmp\$PROGRAMFILES\MSBuild "%PROGRAMFILES(X86)%\MSBuild" /E /Y
mkdir "%PROGRAMFILES(X86)%\MonoGame\v3.0\Assemblies\"
xcopy .\tmp\Assemblies "%PROGRAMFILES(X86)%\MonoGame\v3.0\Assemblies" /E /Y
displayName: 'Install MonoGame $(monoGameVersion)'
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
这会下载指定版本的 MonoGame,解压并安装它(我从this article 找到了配置)。可以理解的是,这只会构建解决方案中设置为启动项目的任何项目。我也在使用 GitVersion 进行自动版本控制,配置文件如下所示:
mode: Mainline
branches: {}
ignore:
sha: []
我想运行一个管道作业/任务/阶段,在 Windows 下构建 DirectX 项目,在 Windows、MacOS 和 Linux 下构建 OpenGL 项目,并可能为每个构建创建工件,尽管我没有研究工件然而。我对使用 Azure Pipelines 很陌生,所以我不确定是否应该为每个平台/项目创建单独的 azure-pipeline.yml 文件,或者是否可以在单个管道配置中定义平台配置。
【问题讨论】:
-
我最近没有机会做这个。我需要创建一个工作镇下载并安装适用于 MacOS 和 Linux 的 MonoGame。
标签: c# azure azure-devops azure-pipelines monogame