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添加到引用中,但没有帮助