Search code examples
asp.netasp.net-coreasp.net-core-webapiappveyor

Appveyoyr fails to build ASP.NET Core WebApi Project


I keep on getting this 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.

My project is set up in Rider, it compiles smoothly localy. I guess it might me something with the MSBuild version.

My appveyor.yml looks like this:

version: 1.0.{build}
image: Visual Studio 2017
configuration: Release
platform: Any CPU
before_build:
- cmd: set ASPNETCORE_ENVIRONMENT=Production
build:
  project: BoatInspectorWebApi.sln
  verbosity: detailed

Can't really think of what's going on.

Has anyone experienced similar issues?

UPDATE (detailed log and exported yml)] I exported the yml to check myself for errors and did a detailed log and the part with the error printed looks like this

Building with tools version "12.0". C:\projects\boatinspectorwebapi\BoatInspectorWebApi\BoatInspectorWebApi.csproj(1,1): 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. Done Building Project "C:\projects\boatinspectorwebapi\BoatInspectorWebApi\BoatInspectorWebApi.csproj" (default targets) -- FAILED.

Well it looks like Appveyor is using MsBuild 12 and that is causing a problem. I am using 15 or 14 localy and everything builds fine. Not sure whether its 14 or 15 cause they are both installed. Anyway, does anyone know if it is possible to build with 15 in Appveyor?


Solution

  • Ok so the problem was very simple. It was in fact MsBuild but it was switcing to version 12 no matter what because Rider hardcodes version 12 into sln file, just change the appropriate version targets inside sln file and everything compiles successfully.