构建 csproj 时出现 AppVeyor 错误

AppVeyor error while building csproj

我有一个混合解决方案,它使用一些 .net core dll 和一个 .Net Framework 4.5.2 dll。我的 VS2015U3 适用于此解决方案,但当我尝试使用 AppVeyor 构建它时,出现错误:

"C:\projects\remoteclient\RemoteClient\RemoteClient.sln" (default target) (1) -> "C:\projects\remoteclient\RemoteClient\test\RemoteClient.WcfTest\RemoteClient.WcfTest.csproj" (default target) (5) -> "C:\projects\remoteclient\RemoteClient\src\RemoteClient.Client\RemoteClient.Client.csproj" (default target) (6) ->
C:\projects\remoteclient\RemoteClient\src\RemoteClient.Client\RemoteClient.Client.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.

但是,我的文件在 2003 format (link for a reference):

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
...

Here is link 到 AppVeyor 构建。

如何修复?

我看到您的解决方案是在 Visual Studio 2017 年构建的。我在 AppVeyor 上为您启用了 beta Visual Studio 2017 RC build worker 镜像。要使用它,您必须在 UI 的环境选项卡中设置 image: Visual Studio 2017 RCin appveyor.yml 或 select image: Visual Studio 2017 RC。请注意,使用 Beta 映像构建启动速度较慢,这是预期的。

如果您不熟悉 appveyor.yml 结构,我强烈建议使用 UI 进行初始配置,然后使用 Export YAML 菜单创建初始 appveyor.yml

另请确保您可以使用 msbuild(而非 VS)在本地成功构建您的解决方案。