[英].Net Core solutions build locally, but fails build on Azure DevOPS pipeline
My .Net Core 2.1 app builds successfully on my local machine, however on my Azure DevOPS pipeline, it fails in the build stage with the following error: 我的.Net Core 2.1应用在本地计算机上成功构建,但是在我的Azure DevOPS管道上,它在构建阶段失败,并出现以下错误:
##[error]Error: C:\hostedtoolcache\windows\dncs\2.1.500\x64\dotnet.exe failed with return code: 1
##[error]Dotnet command failed with non-zero exit code on the following projects : D:\a\1\s\API\API.csproj,D:\a\1\s\AuthCore\AuthCore.csproj,D:\a\1\s\DomainModel\DomainModel.csproj,D:\a\1\s\Repo\Repo.csproj
I have added the .Net Core SDK installer before the restore step in the pipeline (and tried various versions) but it fails the same way every time. 我已经在管道中的还原步骤之前添加了.Net Core SDK安装程序(并尝试了各种版本),但是每次都以相同的方式失败。
The full log file of the build stage is available here: LINK 可以在此处找到构建阶段的完整日志文件: LINK
.Net Core solutions build locally, but fails build on Azure DevOPS pipeline
.Net Core解决方案在本地构建,但无法在Azure DevOPS管道上构建
According to the error messages in your link, like following: 根据您链接中的错误消息,如下所示:
The type or namespace name 'DataAnnotations' does not exist in the namespace 'System.ComponentModel'
类型或名称空间名称“ DataAnnotations”在名称空间“ System.ComponentModel”中不存在
It seems you are missing the references when you build the project/solution. 似乎在构建项目/解决方案时缺少参考。 So, if you add those references with nuget, you may need also add a nuget restore task to restore those nuget packages.
因此,如果您使用nuget添加这些引用,则可能还需要添加nuget restore任务以还原那些nuget软件包。
Check the details info from .NET Core task 从.NET Core任务检查详细信息
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.