azure-devops - 来自 Azure DevOps Build : Could not locate the assembly "System.ComponentModel.Annotations" 的错误

标签 azure-devops azure-pipelines .net-standard .net-standard-2.0

我有一个 netstandard 2.0 项目,引用了 System.ComponentModel.Annotations .它在我的本地计算机上构建良好,但是当我尝试使用 Azure DevOps 管道构建它时,出现以下错误:

...warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.ComponentModel.Annotations". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/home/vsts/work/1/s/src/MyProj/MyProj.csproj]

...MyProj/MyClass.cs(2,29): error CS0234: The type or namespace name 'DataAnnotations' does not exist in the namespace 'System.ComponentModel' (are you missing an assembly reference?) [/home/vsts/work/1/s/src/MyProj/MyProj.csproj]


该错误是不言自明的,我明白它说的是什么,但问题是我应该如何解决它以满足 Azure DevOps 构建?

最佳答案

发现问题。而不是引用 System.ComponentModel.Annotations在我的项目依赖项中,我应该安装 System.ComponentModel.Annotations NuGet package .

我安装了包,Azure DevOps Build 成功构建了项目。

Show-off

关于azure-devops - 来自 Azure DevOps Build : Could not locate the assembly "System.ComponentModel.Annotations" 的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53030310/

相关文章:

azure - VSCode Azure Functions - 错误 : Cannot read properties of undefined (reading 'createClient' )

powershell - Azure DevOps 构建管道 - 无法在脚本中访问 $(Build.BuildNumber)

c# - .net 标准库中的 HttpContext

azure - 有没有办法将团队项目及其工作项从 VSTS (Azure DevOps) 实例导出到本地 TFS 2018 Server 实例?

Azure应用服务: Deployment Source missing options [radio vs dropdown]

azure-devops - 如何为 Nuget Artifact 配置 Azure Devops Pipeline 包名称

azure-devops - 如何手动将文件发布到 Azure Artifacts?

azure - 如何安全地将凭据放入自定义 Azure DevOps 任务中?

c# - Visual Studio 2017 (.NET Core) 中的自动版本控制

android - 调试 - 在 Xamarin.Forms Android 应用程序 (VS 2017) 中引用 .NET 标准 1.4 库