Published on:Nov 07, 2019
Views: 1156
Number of votes: 6
Average rating:

Introducing Code analyzers for Episerver

Code analyzers for Episerver is a new Roslyn-based plugin that analyzes your Episerver code as you type. It can help you avoid some problems with editor experience and code maintainability.
The plugin will show live warnings ("squiggles") in Visual Studio while you are typing.


Inspired by a recent blog post, Code analyzers for Episerver looks for the correct use of content type and property attributes to ensure a good experience for your editors.

The analyzer rules can be configured individually and phased in gradually in a larger codebase.

Code analyzers for Episerver also looks for the use of known legacy types and 'Internal' namespaces that should be avoided in your code.


Each analyzer rule severity can be configured in a ruleset file similar to Visual Studios built-in code analysis.


Code analyzers for Episerver is installed per-project as a NuGet package from the Episerver feed.

Visual Studio automatically detects and executes the analyzers. Build servers will also execute the analyzer rules on every build.


Code analyzers for Episerver is compatible with the compilers in Visual Studio 2019 and Visual Studio 2017 (15.5+).

If your project references an old version of the Microsoft.Net.Compilers package you may need to upgrade this to 2.6.1+ for compatibility with Code analyzers for Episerver.

Nov 07, 2019

Petter Klang
( By Petter Klang, 11/7/2019 8:50:38 AM)


Antti Alasvuo
( By Antti Alasvuo, 11/7/2019 4:51:24 PM)

Very nice Mads!

David Knipe
( By David Knipe, 11/8/2019 7:20:04 AM)

Very nice! 

Johan Björnfot
( By Johan Björnfot, 11/20/2019 10:56:36 AM)

Nice! A nice addition would be an analyzer that detects if you use types from internal namespaces (I have a prototype of such an analyzer in some closet somewhere ;-) ).

Mads Storm Hansen
( By Mads Storm Hansen, 11/20/2019 11:44:49 AM)

Thanks Johan. It already detects types from Internal Episerver/Mediachase namespaces.

Latest addition (v1.1) is detecting use of older concrete Order classes (Cart, LineItem etc.) where interfaces are preferred.

( By linuse, 11/30/2019 10:32:02 AM)

Nice work Mads - very useful!

Please login to comment.