Skip to content

Commit bc47262

Browse files
authored
Merge pull request #2892 from gewarren/landing-page
Add FAQ for fxcop analyzers
2 parents 93ff7c8 + ec9d238 commit bc47262

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: FxCop code analysis and FxCop analyzers
3+
ms.date: 09/06/2018
4+
ms.prod: visual-studio-dev15
5+
ms.technology: vs-ide-code-analysis
6+
ms.topic: overview
7+
helpviewer_keywords:
8+
- "code analysis FAQ"
9+
author: gewarren
10+
ms.author: gewarren
11+
manager: douge
12+
ms.workload:
13+
- "dotnet"
14+
---
15+
# Frequently asked questions about FxCop and FxCop analyzers
16+
17+
It can be a little confusing to understand the differences between legacy FxCop and FxCop analyzers. This article aims to address some of questions you might have.
18+
19+
## What's the difference between legacy FxCop and FxCop analyzers?
20+
21+
Legacy FxCop runs post-build analysis on a compiled assembly. It runs as a separate executable called **FxCopCmd.exe**. FxCopCmd.exe loads the compiled assembly, runs code analysis, and then reports the results (or *diagnostics*).
22+
23+
FxCop analyzers are based on the .NET Compiler Platform ("Roslyn"). You [install them as a NuGet package](install-fxcop-analyzers.md#to-install-fxcop-analyzers-as-a-nuget-package) that's referenced by the project or solution. FxCop analyzers run source-code based analysis during compiler execution. FxCop analyzers are hosted within the compiler process, either **csc.exe** or **vbc.exe**, and run analysis when the project is built. Analyzer results are reported along with compiler results.
24+
25+
> [!NOTE]
26+
> You can also [install FxCop analyzers as a Visual Studio extension](install-fxcop-analyzers.md#to-install-fxcop-analyzers-as-a-vsix). In this case, the analyzers execute as you type in the code editor, but they don't execute at build time. If you want to run FxCop analyzers as part of continuous integration (CI), install them as a NuGet package instead.
27+
28+
## Does the Run Code Analysis command run FxCop analyzers?
29+
30+
No. When you select **Analyze** > **Run Code Analysis** in Visual Studio 2017, it executes static code analysis or legacy FxCop. **Run Code Analysis** has no effect on Roslyn-based analyzers, including the Roslyn-based FxCop analyzers.
31+
32+
## Does the RunCodeAnalysis msbuild project property run analyzers?
33+
34+
No. The **RunCodeAnalysis** property in a project file (for example, *.csproj*) is only used to execute legacy FxCop. It runs a post-build msbuild task that invokes **FxCopCmd.exe**. This is equivalent to selecting **Analyze** > **Run Code Analysis** in Visual Studio.
35+
36+
## So how do I run FxCop analyzers then?
37+
38+
To run FxCop analyzers, first [install the NuGet package](install-fxcop-analyzers.md) for them. Then build your project or solution from Visual Studio or using msbuild. The warnings and errors that the FxCop analyzers generate will appear in the **Error List** or the command window.
39+
40+
## See also
41+
42+
- [Overview of .NET Compiler Platform analyzers](roslyn-analyzers-overview.md)
43+
- [Get started with analyzers](fxcop-analyzers.yml)
44+
- [Install FxCop analyzers](install-fxcop-analyzers.md)

docs/code-quality/fxcop-analyzers.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ abstract:
2121
src: https://docs.microsoft.com/media/illustrations/bcs-partner-advanced-management-settings-8.svg
2222
title:
2323
sections:
24+
- title: Frequently asked questions
25+
items:
26+
- html: Get answers to some <a href="fxcop-analyzers-faq.md">frequently asked questions</a> about the differences between FxCop and analyzers.
27+
2428
- title: If you're new to code analysis...
2529
items:
2630
- type: list

docs/code-quality/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
items:
2929
- name: Code analysis for managed code
3030
items:
31+
- name: FAQ for FxCop analyzers
32+
href: fxcop-analyzers-faq.md
3133
- name: Migrate from FxCop
3234
href: fxcop-analyzers.yml
3335
items:

0 commit comments

Comments
 (0)