VSTS - 使用 ASP.NET Core 2.0 构建应用程序失败,出现“包 Microsoft.Extensions.FileProviders.Physical 2.0.0 不兼容”的错误。

7
我正在尝试在VSTS上为我的ASP.NET Core 2.0 Web应用设置Build,但它在Nuget Restore阶段失败:

包Microsoft.Extensions.FileProviders.Physical 2.0.0与netcoreapp2.0(.NETCoreApp,Version=v2.0)不兼容。包Microsoft.Extensions.FileProviders.Physical 2.0.0支持:netstandard2.0(.NETStandard,Version=v2.0)

包Microsoft.VisualStudio.Web.CodeGeneration.Contracts 2.0.0与netcoreapp2.0(.NETCoreApp,Version=v2.0)不兼容。包Microsoft.VisualStudio.Web.CodeGeneration.Contracts 2.0.0支持:netstandard2.0(.NETStandard,Version=v2.0)

我创建Build时选择了Azure中的App Service(或类似的选项)。那么,我现在该如何设置Build呢?
1个回答

16

请使用 .Net Core 恢复任务。

关于 NuGet 恢复,您需要使用 4.3 版本:

  1. 添加 NuGet 工具安装程序任务(要安装的 NuGet.exe 的版本:4.3.0)
  2. NuGet 恢复任务(版本 2.*)

对我有用!! - l3utterfly
哦,非常感谢,它起作用了...我找到了NuGet安装程序,但没有注意到NuGet还原任务本身的属性...版本2.* - Dmitry Gusarov
答案对我来说仍然适用,用于修复netcoreapp2.2的相同错误。对我来说,在Azure Devops中使用NuGet Restore(需要私有feed访问)时才会出现此错误,但在dotnet restore中不会出现。 - Juliën
我的问题.. https://stackoverflow.com/questions/57172204/azure-devops-build-fails-for-aspnetcore-2-1-mvc-application - Ziggler
工作得非常好!我使用的是Nuget 4.1.0版本,很惊讶使用4.3.0有所不同。 - Mani5556

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接