我有一个 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 成功构建了项目。
关于azure-devops - 来自 Azure DevOps Build : Could not locate the assembly "System.ComponentModel.Annotations" 的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53030310/