我正在C#中进行项目。现在我已经设置了一个Hudson服务器a我已经在服务器上安装了.Net 4 Framework和Windows SDK 7.1。
项目构建成功,但当我启动FxCop时使用:
"C:Program Files (x86)Microsoft FxCop 1.35fxcopcmd.exe" /file:CommonServiceToolbinRelease /out:fxcop-result.xml
它加载所有.dll规则文件,然后发生以下异常:
Using system files at: C:WINDOWSMicrosoft.NETFrameworkv4.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库。有人能帮我吗?
确保项目->选项…-拼写&Analysis->选中"搜索全局程序集缓存中缺少的引用"(根据FxCop和GAC Madness)。
您是直接运行fxcopcmd.exe还是通过插件运行?如果是前者,请尝试添加/gac
命令行开关。如果您使用的是中介跑步者,它是什么?
我在使用fxcopcmd V12时遇到了类似的问题。我可以通过显式添加来解决这个问题
/reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0WindowsBase.dll"
请参阅:WPF组件上的FxCop引擎异常
好的,我明白了!
FxCop 1.35不适用于WPF。现在我已经安装了FxCop 10.0。现在它起作用了。但是谢谢大家的帮助!