Azure Devops 构建管道:未使用 Yaml 文件中的构建配置
Azure Devops build pipelines : build configuration in Yaml file not used
我有一个构建管道 yaml 文件,如下所示:
# ...
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Production 12'
# ...
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
Production 12|任何 CPU 配置都应该被构建。
但不是,另一个是(Test|Any CPU),如日志所示:
Starting: VSBuild
==============================================================================
Task : Visual Studio build
Description : Build with MSBuild and set the Visual Studio version property
Version : 1.199.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/visual-studio-build
==============================================================================
"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda.199.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [17.0,18.0) -latest -format json
"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda.199.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [17.0,18.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda.199.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -latest -format json
"C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Current\Bin\msbuild.exe" "D:\a\s\SafeProtect.sln" /nologo /nr:false /dl:CentralLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda.199.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=10c69004-b8fb-410e-ba0d-6d600dac481c|SolutionDir=D:\a\s|enableOrphanedProjectsLogs=true"*ForwardingLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda.199.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="D:\a\a\WebApp.zip" /p:platform="Any CPU" /p:configuration="Test" /p:VisualStudioVersion="16.0" /p:_MSDeployUserAgent="VSTS_09716650-7645-4cc6-8318-3b574bba08b5_build_1_0"
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Build started 3/17/2022 12:36:04 PM.
Project "D:\a\s\SafeProtect.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Test|Any CPU".
发生了什么事?
Azure Devops build pipelines : build configuration in Yaml file not used
首先,请尝试检查您是否缺少配置属性中带有 Visual Studio 的构建配置,或者未选中构建复选框。
右键单击该解决方案,选择“属性”,然后查看“配置属性”属性 sheet:
其次,尝试在您的本地构建和部署它以检查您是否有此问题,如果没有,请检查 MSBuild 版本(Visual Studio 版本)和.net framework 版本上的版本Azure 开发运营。
我通过重新创建构建管道(.yml 文件)解决了这个问题。
所以我猜想在修改 .yml 文件以更新管道任务时处理 .yml 文件时出现故障。
我有一个构建管道 yaml 文件,如下所示:
# ...
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Production 12'
# ...
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
Production 12|任何 CPU 配置都应该被构建。
但不是,另一个是(Test|Any CPU),如日志所示:
Starting: VSBuild
==============================================================================
Task : Visual Studio build
Description : Build with MSBuild and set the Visual Studio version property
Version : 1.199.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/visual-studio-build
==============================================================================
"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda.199.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [17.0,18.0) -latest -format json
"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda.199.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [17.0,18.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda.199.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -latest -format json
"C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Current\Bin\msbuild.exe" "D:\a\s\SafeProtect.sln" /nologo /nr:false /dl:CentralLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda.199.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=10c69004-b8fb-410e-ba0d-6d600dac481c|SolutionDir=D:\a\s|enableOrphanedProjectsLogs=true"*ForwardingLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda.199.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="D:\a\a\WebApp.zip" /p:platform="Any CPU" /p:configuration="Test" /p:VisualStudioVersion="16.0" /p:_MSDeployUserAgent="VSTS_09716650-7645-4cc6-8318-3b574bba08b5_build_1_0"
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Build started 3/17/2022 12:36:04 PM.
Project "D:\a\s\SafeProtect.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Test|Any CPU".
发生了什么事?
Azure Devops build pipelines : build configuration in Yaml file not used
首先,请尝试检查您是否缺少配置属性中带有 Visual Studio 的构建配置,或者未选中构建复选框。
右键单击该解决方案,选择“属性”,然后查看“配置属性”属性 sheet:
其次,尝试在您的本地构建和部署它以检查您是否有此问题,如果没有,请检查 MSBuild 版本(Visual Studio 版本)和.net framework 版本上的版本Azure 开发运营。
我通过重新创建构建管道(.yml 文件)解决了这个问题。 所以我猜想在修改 .yml 文件以更新管道任务时处理 .yml 文件时出现故障。