1
votes

I have a solution, mostly made up of .NET Framework 4.5 projects.

Recently, we added a project (library) that targets both netstandard2.0 and net45.

This was achieved by making the following amendments to the .proj file of the new library.

targeting

This builds fine in VS2019, but when pushed to Azure DevOps (building using the VS2019 agent) it fails with the following error.

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.

enter image description here

Can anyone please advise?


Edit 1:

Here is my 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)'

It appears that (even though I am able to choose VS2019 as an option in my build pipeline)... Visual Studio 2019 isn't available on Azure DevOps?

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

enter image description here

Any idea how I can get this to work?

1
Are you using the right hosted build agent? You should use the one Hosted Windows 2019 with VS2019, check the queue your build definition is actually using?Leo Liu-MSFT
This was the issue, which I found and fixed. You are welcome to add the answer and I will accept.Beakie

1 Answers

1
votes

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

Since you are using Visual Studio 2019 on your local, so you should build the solution on the Azure Devops with agent Hosted Windows 2019 with VS2019, which with Visual Studio installed by default.

Hope this helps.