An error from Azure DevOps Build: Could not locate the assembly “System.ComponentModel.Annotations”

拟墨画扇 提交于 2019-12-23 18:34:01

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/53030310/an-error-from-azure-devops-build-could-not-locate-the-assembly-system-componen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!