Identifying performance improvements to source code using FxCop analyzers
In this section, we will introduce you to a popular third-party analyzer package for C# projects, FxCop analyzers. We will walk through how to install the FxCop analyzers NuGet package and give examples violations for different performance rules and show you how to automatically fix some of these issues with the code fixes that come along with the analyzers in the NuGet package.
Getting ready
You will need to have Visual Studio 2017 installed on your machine to execute the recipes in this chapter. You can install a free community version of Visual Studio 2017 from https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=15.
How to do it...
- Start Visual Studio and click
File |
New |
Project...
and create a new C# class library project and replace the code inClass1.cs
with code from the code sample atClassLibrary\Class1.cs
. - Install the
Microsoft.CodeAnalysis.FxCopAnalyzers
NuGet package (the...