msbuild GenerateDepsFile 失败

msbuild GenerateDepsFile fails

我的所有项目都在我的 Azure DevOps MacOS 构建主机上构建失败。它是一个自托管的构建主机。突然,我的项目在尝试构建时抛出此错误:

error MSB4018: The "GenerateDepsFile" task failed unexpectedly.
error MSB4018: System.MissingMethodException: Method not found: System.Collections.Generic.IList`1<NuGet.Packaging.Core.PackageDependency> NuGet.ProjectModel.LockFileTargetLibrary.get_Dependencies()

我发现这个 GitHub 问题看起来很相似,但发布的解决方案对我没有帮助: https://github.com/mono/mono/issues/13537

As mentioned in xamarin/xamarin-android#3155 this is caused by a version mismatch in nuget between msbuild and dotnet core. The solution is to update your dotnet core install to the latest stable version

我已经安装了最新的 .NET Core,并为 Mac 更新了 Visual Studio,但是问题仍然存在。

另外一个信息: 当我从我的 Windows 机器和相同的 MacOS 构建主机构建相同的 Xamarin.iOS 项目时,应用程序构建得很好。但我猜这个过程可能不同。

今天再次为 Mac 和 .NET Core SDK 更新 Visual Studio 似乎解决了这个问题。