Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 2012 在VS2012中运行代码分析时出错:无法解析类型引用_Visual Studio 2012_Code Analysis - Fatal编程技术网

Visual studio 2012 在VS2012中运行代码分析时出错:无法解析类型引用

Visual studio 2012 在VS2012中运行代码分析时出错:无法解析类型引用,visual-studio-2012,code-analysis,Visual Studio 2012,Code Analysis,当我单击运行代码分析项目上下文菜单项时。建筑开始,但由于以下错误而停止: CA0001 Error Running Code Analysis CA0001 : The following error was encountered while reading module 'EntityFramework': Could not resolve type reference: [System.ComponentModel.DataAnnotations, Version=4.0.0.0

当我单击
运行代码分析
项目上下文菜单项时。建筑开始,但由于以下错误而停止:

CA0001  Error Running Code Analysis 
CA0001 : The following error was encountered while reading module 'EntityFramework': 
Could not resolve type reference: 
[System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35]System.ComponentModel.DataAnnotations.Schema.ColumnAttribute.   [Errors and Warnings]   (Global)

对其他项目的分析效果良好。如何消除这个问题

应用程序可能不使用System.ComponentModel.DataAnnotations dll,但EntityFramework.dll在内部引用了它。代码分析将查看所有引用的dll,并尝试解析它们的引用。如果将System.ComponentModel.DataAnnotations.dll添加到应用程序中,下次运行代码分析时,此错误将消失。

我尝试了Scott Wylie提到的解决方案。我尝试在我的项目中添加对System.ComponentModel.DataAnnotations的引用,但没有帮助


然后,我尝试将System.ComponentModel.DataAnnotations.dll直接复制并粘贴到我的bin文件夹中,结果成功了。将dll添加到本地bin文件夹中,发布解决方案,然后手动将dll添加到已发布项目的bin文件夹中(如果它没有自己复制)。

我尝试将System.ComponentModel.DataAnnotations dll添加到引用中,但没有帮助