Questions tagged [fxcop]

Microsoft's free static analysis tool for analyzing .NET managed code assemblies.

FxCop can be used to find coding design issues quickly and early, comes with switchable rulesets, and supports the creation of custom rules.

Available with certain versions of Visual Studio and as part of the Windows 7 SDK, available here.

749 questions
9
votes
1 answer

FX COP Could not resolve type reference: System.Windows.Input.ICommand

Having troubles with FXCOP on our buildagent ONLY and only through the command line tool ONLY. I am using the Caliburn.Mirco framework and added a custom trigger so i can use the delete button. this class implements the ICommand interface the error…
theHaggis
  • 615
  • 7
  • 18
8
votes
2 answers

FxCop and Code Analysis Rules

I recently started using Code Analysis on my projects in Visual Studio. I have created a custom ruleset to use with all of my projects that include two of the Microsoft defined rulesets. I've been working to integrate FxCop into the CI build process…
Hungry Beast
  • 3,677
  • 7
  • 49
  • 75
8
votes
1 answer

FxCop and GAC Madness

Using FxCop when I try to analyze projects that rely on Patterns and Practices, Enterprise Library Data (among others) 2.0.0.0 - FxCop complains that it can’t: “Locate Assembly Reference” - even though the application dll being analyzed was complied…
Mark Levison
  • 788
  • 3
  • 9
  • 22
8
votes
2 answers

Determining if a method calls a method in another assembly containing a new statement and vice-versa

I want to write a rule that will fail if an object allocation is made within any method called by a method marked with a particular attribute. I've got this working so far, by iterating up all methods calling my method to check using…
George Duckett
  • 31,770
  • 9
  • 95
  • 162
8
votes
1 answer

How can you get FxCop rule CA1726 to ignore a preferred term?

FxCop has a rule (CA1726) that checks for preferred terms. This looks for words like "Dont" and tells you to replace them with better words like "Do not". Generally this is fine, however one of the terms it objects to is "Flag". At our firm, the…
Martin Brown
  • 24,692
  • 14
  • 77
  • 122
8
votes
6 answers

Doing .NET 4.0 static code analysis (FxCop) with VS 2010 Professional

I have VS 2010 Professional (which, unlike Premium, does not include access to Code Analysis configuration within the IDE), and a C# 4 solution containing many-dozen projects. I want to do static code analysis as part of solution compilation. The…
AakashM
  • 62,551
  • 17
  • 151
  • 186
8
votes
4 answers

Code analysis/FxCop in VS2008

FxCops is something new to me, but as always I would like to get to know the new things.. From what I've read, FxCops is already included in VS2008. I guess it's the "Code Analysis" function. Whenever I try to run it though, it seems to start a…
Boris Callens
  • 90,659
  • 85
  • 207
  • 305
8
votes
3 answers

.NET [SuppressMessage] attributes in shipping assemblies fxcop

I wonder if people (meaning the company/developers) really care about having [SuppressMessage] attributes lying around in the shipping assemblies. Creating separate configs in the Project files that include CODE_ANALYSIS in Release mode and then…
mherle
  • 504
  • 3
  • 12
8
votes
3 answers

Creating a readable FxCop report

Is there a good tool that can convert the XML output of FxCop into something that can be put into a Word document? I'd prefer not to write an XML-FO XSLT transform, maybe someone did something like that already.
User1
  • 39,458
  • 69
  • 187
  • 265
8
votes
3 answers

Should I use FxCop and why?

I'm working on a project in C# .net and WPF. We're using StyleCop to help bring a consistent style to the project, and after disabling some rules we're quite satisfied with it. However, I've heard people talk about FxCop, and that this would bring…
stiank81
  • 25,418
  • 43
  • 131
  • 202
8
votes
2 answers

Best way of using List and exposing Collection

I must implement a web service which expose a list of values (integers, custom classes etc). My working solution returns a List, and according to FxCop it is better to return a Collection or ReadOnlyCollection. If I choose to return a…
alexandrul
  • 12,856
  • 13
  • 72
  • 99
8
votes
2 answers

Treat Warnings as Errors has no effect

In my project's settings in Visual Studio, I have set 'Treat warnings as errors' to 'All'. The Warning level is set to 4. I tested this by deliberately introducing code that violates CA1305, but it builds (and rebuilds) successfully, returning a…
Matt
  • 195
  • 1
  • 4
  • 12
8
votes
1 answer

How to silence fx cop warning CS0067?

On a build server, I see some weird message. It doesn't say so, but I think it's from some software called 'fx cop' Warning CS0067: The event 'SunGard.Adaptiv.AnalyticsEngine.UI.CommonControls.DisabledCommand.CanExecuteChanged' is never used How…
Colonel Panic
  • 132,665
  • 89
  • 401
  • 465
8
votes
4 answers

Why is DB an acronym and not abbreviation?

According to the .NET framework design guidelines, they say DB is an acronym and cased as such. But I thought it was an abbreviation of database?
squi
8
votes
1 answer

Integrating FxCop and StyleCop into TFS 2010/VS continuous integration process

I'm setting up a continuous build process on Jenkins, TeamCity and TFS 2010 to compare them. In Jenkins and TeamCity I'm building the project on every check-in, and I've set up FxCop and StyleCop analysis and reporting. Now I want to do this in TFS…
user479911