我有两个针对 .Net Framework 4 的项目的解决方案。该解决方案在 Visual Studio 2015 和 2017 以及 msbuild 命令行中成功构建。
但是,当它使用代理规范 vs2015-win2012r2 在 Azure DevOps Pipeline 中构建时,第一个项目失败并出现以下错误。NuGet 还原步骤显示它成功安装了 NuGet EntityFramework 5.0 包。
The type or namespace name 'Infrastructure' does not exist in the namespace 'System.Data.Entity' (are you missing an assembly reference?)
The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'DbModelBuilder' could not be found (are you missing a using directive or an assembly reference?)
当我将代理规范更改为 vs2017-win2016 时,第一个项目构建没有错误,但第二个项目失败并出现以下错误:
The type or namespace name 'Description' does not exist in the namespace 'System.Web.Http' (are you missing an assembly reference?)
The type or namespace name 'Http' does not exist in the namespace 'System.Net' (are you missing an assembly reference?)
Error CS0234: The type or namespace name 'Http' does not exist in the namespace 'System.Net' (are you missing an assembly reference?)
我确实在包含 System.Web.Http.dll 的 csproj 文件中引用了 NuGet 包 Microsoft.Asp.Net.WebApi.Core.4.0.20710.0。
我已经打开了调试选项。以下是 NuGet 还原日志的链接https://drive.google.com/open?id=1lJWflXTjYTN_MQyLOnwMUr-8LKoR5JRo
和构建日志 https://drive.google.com/open?id=1ypAVWxniDLfBOBHc4gODdAoQOCQnphYg