我在ci / cd中遇到天蓝色任务的问题, 每个发行版都有一个测试任务,该任务在部署代码之前以及每次构建所有解决方案时都需要运行。 我只希望构建与发行版相关的特定项目,而不是所有解决方案。 我该如何解决?
答案 0 :(得分:1)
根据您的SO标签,看来您正在使用C#。
要在构建任务中构建一个针对.net framework
的特定项目:
您应该使用MSBuild task而不是Visual Studio Build task。
要在构建任务中构建一个针对.net core/standard
的特定项目:
您应在此类输入中使用Dotnet build:
此外,如果您在发布任务中使用Dotnet测试,它将自动构建要测试的项目,除非您添加--no-build
开关。因此,您还需要确保指定要测试的特定项目,而不是使用**/*.csproj
。
答案 1 :(得分:0)
trigger:
branches:
include:
- master
pool:
name: Azure Pipelines
vmImage: 'windows-2019'
demands:
- msbuild
- visualstudio
variables:
BuildConfiguration: "Release"
platform: any cpu
BuildPlatform: any cpu
name: 1.$(build.buildid)
stages:
- stage: Build
jobs:
- job: Build
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: 'path to sln file/xxxxxxx.sln'
vstsFeed: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: 'path to sln file/xxxxxxx.sln'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
clean: true