V2-V3 管道对话后的"__built-in-schema.yml (Line: 2012, Col: 24): Expected a mapping"



UPDATE:这是azure_pipelines.yml:的内容

resources:
repositories:
- repository: pf
type: git
name: _
ref: refs/tags/3.6.6
trigger: none
stages:
- template: __
parameters:
project:
- name: "__" # Must be unique within the list of projects
type: "msbuild" # Used with Publish/Deploy.  Options: adla, dacpac, dotnet, egg, maven, msbuild, node, nuget, python, sap, ssis
path: "__" # Project Path
file: "__.csproj" # Project file
toolset: "msbuild" # Used with Build/Package.  Options: adla, dotnet, maven, msbuild, node, python, sap, ssis
playbook: "___.yml"
sonarqube:
name: scan
scan: true
sqExclusions: ""
additionalProperties: "" #|
#            sonar.branch.name=master
#            sonar.branch.target=master
fortify: 
fortifyApp: "_______" 
fortifyVersion: "____"
sast: true
dast: false
buildConfiguration: $(BuildConfiguration) #release, debug
buildPlatform: $(BuildPlatform) #any cpu, x86, x64
- name: "__" # Must be unique within the list of projects
type: "msbuild" # Used with Publish/Deploy.  Options: adla, dacpac, dotnet, egg, maven, msbuild, node, nuget, python, sap, ssis
path: "___" # Project Path
file: "___.csproj" # Project file
toolset: "msbuild" # Used with Build/Package.  Options: adla, dotnet, maven, msbuild, node, python, sap, ssis
playbook: "_.yml"
sonarqube:
name: scan
scan: true
sqExclusions: ""
additionalProperties: "" #|
#            sonar.branch.name=master
#            sonar.branch.target=master
fortify: 
fortifyApp: "______" 
fortifyVersion: "__"
sast: true
dast: false
buildConfiguration: $(BuildConfiguration) #release, debug
buildPlatform: $(BuildPlatform) #any cpu, x86, x64

我正在尝试为一个经过V2到V3管道转换的.NET Framework 4.7应用程序运行ADO管道。我收到以下错误消息,构建甚至没有尝试运行:

__built-in-schema.yml: Maximum object depth exceeded
__built-in-schema.yml (Line: 2012, Col: 24): Expected a mapping
__built-in-schema.yml: Maximum object depth exceeded

这是使用msbuild工具集。我在解决方案中有一个API项目和一个web应用程序项目,所以如果我删除了它们中的任何一个,然后运行管道,它会进展到这个阶段,但会挂起另一个错误。(不过,没有必要详细说明这个错误,因为它与我删除了另一个项目直接相关(。

使用dotnet工具集,它运行,但随后抱怨缺少一个引用:

> D:a1s______.csproj(350,3): error MSB4019: The imported project "C:Program Filesdotnetsdk3.1.101MicrosoftVisualStudiov16.0WebApplicationsMicrosoft.WebApplication.targets" was not found. Confirm that the expression in the Import declaration "C:Program Filesdotnetsdk3.1.101MicrosoftVisualStudiov16.0WebApplicationsMicrosoft.WebApplication.targets" is correct, and that the file exists on disk.
0 Warning(s)

我已经尝试在应用程序的.csproj文件中注释掉对Microsoft.WebApplication.targets的引用,但它只是在我本地或通过管道运行构建时将它们添加回来。

我还尝试过将构建池更改为VS 2017,并将Hosted Windows 2019与VS2019一起更改,认为VS目标将在这些池中可用,但没有成功。

我还尝试通过NuGet安装MSBuild.Microsoft.VisualStudio.Web.targets,但最终得到了相同的结果。

我在这里错过了什么?

"__built-in-schema.yml(行:2012,列:24(:预期映射"在V2-V3管道转换之后

根据错误日志:

错误MSB4019:导入的项目"C:\ProgramFiles\dotnet\sdk\3.1.101\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets"未找到

我们可以知道从dotnet SDK而不是MSBuild调用的Microsoft.WebApplication.targetsMicrosoft.WebApplication.targets的正确路径应该是:

C:Program Files (x86)Microsoft Visual Studio2019ProfessionalMSBuildMicrosoftVisualStudiov16.0WebApplicationsMicrosoft.WebApplication.targets

因此,我们需要使用MSBuild工具集而不是dotnet工具集。由于它使用MSBuild 16.0,我们需要使用带有VS2019的构建代理池Hosted Windows 2019来构建项目。

对于错误Maximum object depth exceeded,您的yaml文件的文件路径似乎太深,请尝试缩短文件路径,看看这是否解决了问题。

如果以上信息对你没有帮助,请分享更多关于你的问题的信息,比如你的项目类型是什么,是python项目吗?并共享您的构建管道(yaml(。

希望这能有所帮助。

最新更新