FxCop无法解析引用

时间:2012-09-05 06:23:04

标签: c# hudson fxcop fxcopcmd

我正在使用C#进行项目。现在我已经设置了一个Hudson服务器 我在服务器上安装了.Net 4 Framework和Windows SDK 7.1。

项目构建成功,但是当我用:

启动FxCop时
"C:\Program Files (x86)\Microsoft FxCop 1.35\fxcopcmd.exe" /file:CommonServiceTool\bin\Release /out:fxcop-result.xml

它加载所有.dll规则文件,然后发生以下异常:

Using system files at: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319.
Could not resolve reference to PresentationFramework.
Could not resolve reference to PresentationCore.
Could not resolve reference to WindowsBase.
12 exceptions occurred while loading Project1.
   00) Could not resolve type reference: [PresentationFramework]System.Windows.StartupEventArgs.
   01) Could not resolve type reference: [PresentationFramework]System.Windows.Window.
   02) Could not resolve type reference: [PresentationFramework]System.Windows.Controls.HeaderedContentControl.
   03) Could not resolve type reference: [PresentationCore]System.Windows.Input.ICommand.
   04) Could not resolve member reference: System.Windows.ThemeInfoAttribute::.ctor.

... and so on...

我在项目中使用WPF,我认为FxCop无法找到WPF库。 有人可以帮我吗?

4 个答案:

答案 0 :(得分:4)

确保项目 - >选项...... - 拼写&分析 - >选中“搜索全局程序集缓存以查找缺少的引用”(根据FxCop and GAC Madness)。

答案 1 :(得分:3)

您是直接运行fxcopcmd.exe还是通过插件运行?如果是前者,请尝试添加/gac命令行开关。如果你正在使用中间人,那是什么?

答案 2 :(得分:1)

我遇到了与fxcopcmd V12类似的问题。 我能够通过明确添加

来解决它
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\WindowsBase.dll"

请参阅:FxCop engine exception on WPF assembly

答案 3 :(得分:0)

好的,我明白了!

FxCop 1.35不适用于WPF。现在我安装了FxCop 10.0。现在它有效。 但是,谢谢大家的帮助!

相关问题