Azure DevOps 上的构建错误 - 由多个目标框架组成的解决方案

Build Error on Azure DevOps - Solution made up of multiple target frameworks

我有一个解决方案,主要由 .NET Framework 4.5 项目组成。

最近,我们添加了一个同时针对 netstandard2.0 和 net45 的项目(库)。

这是通过对新库的 .proj 文件进行以下修改来实现的。

这在 VS2019 中构建良好,但是当推送到 Azure DevOps(使用 VS2019 代理构建)时它失败并出现以下错误。

Error MSB4041: The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.

谁能指点一下?


编辑 1:

这是我的 YAML...

  PublishProfile: 'VSORelease'

steps:
- task: VSBuild@1
  displayName: 'Build solution Retailer/Retailer.sln'
  inputs:
    solution: Retailer/Retailer.sln
    vsVersion: 16.0
    msbuildArgs: '/p:DeployOnBuild=true /p:PublishProfile="$(PublishProfile)"'
    platform: '$(BuildPlatform)'
    configuration: '$(BuildConfiguration)'

看来(尽管我可以在构建管道中选择 VS2019 作为选项)...Visual Studio2019 在 Azure DevOps 上不可用?

[warning] Visual Studio version '16.0' not found. Falling back to version '14.0'.

知道如何让它工作吗?

Build Error on Azure DevOps - Solution made up of multiple target frameworks

由于您在本地使用 Visual Studio 2019,因此您应该在 Azure Devops 上使用代理构建解决方案 Hosted Windows 2019 with VS2019 ,默认安装 Visual Studio。

希望对您有所帮助。