CoolKiffings
CoolKiffings

Reputation: 567

FxCop can't resolve references

I'm working on project in C#. Now I've set up a Hudson server an I've installed the .Net 4 Framework and the Windows SDK 7.1 on the server.

The project builds successfully but when I start FxCop with:

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

It loads all .dll rule files and after that the following exceptions happens:

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...

I'm using WPF in the project and I think FxCop can't find the WPF libraries. Can someone help me on this?

Upvotes: 5

Views: 7743

Answers (4)

Harry B.
Harry B.

Reputation: 51

I had a similar problem with fxcopcmd V12. I was able to solve it by explicitly adding

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

See: FxCop engine exception on WPF assembly

Upvotes: 1

CoolKiffings
CoolKiffings

Reputation: 567

Ok, I got it!

FxCop 1.35 doesn't work with WPF. Now I've installed FxCop 10.0. Now it works. But thank you all for the help!

Upvotes: 0

Nicole Calinoiu
Nicole Calinoiu

Reputation: 21002

Are you running fxcopcmd.exe directly or via a plug-in? If the former, try adding the /gac command line switch. If you're using an intermediary runner, what is it?

Upvotes: 4

akton
akton

Reputation: 14386

Ensure Project -> Options... - Spelling & Analysis -> "Search Global Assembly Cache for missing references" is checked (as per FxCop and GAC Madness).

Upvotes: 4

Related Questions