我有复杂的ish C#解决方案,通过Azure管道构建.
这是一个MonoGame v3.7.1项目,我在一个公共GitHub回购中托管了几个项目。解决方案结构如下所示:
- AzureTest
- AzureTest.Core
- AzureTest.DirectX
- AzureTest.OpenGL核心项目是一个共享项目,不能运行,而DirectX和OpenGL都引用.Core,并且可以运行。所有游戏代码将生活在核心项目。
我当前的蔚蓝-管道配置文件如下所示:
# .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://learn.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,提取并安装它(我从这篇文章中找到了配置)。显然,这只会构建任何在解决方案中设置为启动项目的项目。我还使用GitVersion进行自动版本控制,配置文件如下所示:
mode: Mainline
branches: {}
ignore:
sha: []我想运行一个管道作业/任务/阶段,它在Windows下构建DirectX项目,在Windows、MacOS和Linux下构建OpenGL项目,并可能为每个构建创建工件,尽管我还没有研究工件。我对使用Azure管道相当陌生,所以我不确定是否应该为每个平台/项目创建单独的azure-管线. for文件,或者是否可以在单个管道配置中定义平台配置。
发布于 2020-02-10 08:32:52
因此,我不确定是否应该为每个平台/项目创建单独的azure-管线. for文件,或者是否可以在单个管道配置中定义平台配置。
答案是肯定的。您可以将多个作业与多个代理并行使用,例如:
jobs:
- job: Windows
pool:
vmImage: 'vs2017-win2016'
steps:
- script: echo hello from Windows
- job: macOS
pool:
vmImage: 'macOS-10.14'
steps:
- script: echo hello from macOS
- job: Linux
pool:
vmImage: 'ubuntu-16.04'
steps:
- script: echo hello from Linux因此,我们可以在DirectX中使用job1中的Windows构建OpenGL项目,在job2、job3、job4中使用相应的代理在Windows、MacOS和Linux下构建OpenGL项目。
注意:如果您有几个作业之间的优先级顺序,请注意使用dependsOn:。
您可以查看文档指定管道中的作业中的详细信息。
希望这能有所帮助。
https://stackoverflow.com/questions/60137627
复制相似问题