Azure DevOps Build 中的错误:找不到程序集“System.ComponentModel.Annotations" [英] An error from Azure DevOps Build: Could not locate the assembly "System.ComponentModel.Annotations"

查看:20
本文介绍了Azure DevOps Build 中的错误:找不到程序集“System.ComponentModel.Annotations"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

<块引用>

...警告 MSB3245:无法解析此引用.找不到程序集System.ComponentModel.Annotations".检查以确保该程序集存在于磁盘上.如果您的代码需要此引用,您可能会遇到编译错误.[/home/vsts/work/1/s/src/MyProj/MyProj.csproj]

...MyProj/MyClass.cs(2,29):错误 CS0234:命名空间System.ComponentModel"中不存在类型或命名空间名称DataAnnotations"(您是否缺少程序集引用?)[/home/vsts/work/1/s/src/MyProj/MyProj.csproj]

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

解决方案

发现问题.我应该安装

I have a netstandard 2.0 project with a reference to System.ComponentModel.Annotations. It builds fine on my local computer, but when I try to build it using Azure DevOps pipeline, I get the following error:

...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]

The error is self-explanatory and I understand what it says, but the question is how should I resolve it to satisfy Azure DevOps build?

解决方案

Found the issue. Instead of making a reference to System.ComponentModel.Annotations in my project dependencies, I should have installed System.ComponentModel.Annotations NuGet package.

I installed the package and Azure DevOps Build successfully built the project.

这篇关于Azure DevOps Build 中的错误:找不到程序集“System.ComponentModel.Annotations"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆