Reference Inspector is a simple build-time tool to enforce
layering and dependency rules between .NET assemblies.
When used with a continuous integration server like
Reference Inspector helps you detect violations of a system's
intended architectural dependencies as soon as they occur, rather
than later when they may be much harder to back out.
The kinds of problems prevented by using Reference Inspector are:
Unwanted deployment dependencies on non-redistributable or
Violations of major layering objectives, such as dependencies
between the business and user interface layers
Dependencies between new code and deprecated/legacy code
An added advantage is that the reference rules can record and
communicate the high-level intentions of a system's architects to new
developers and future maintainers.
Reference Inspector is similar in intent to FxCop,
however while FxCop is intended to enforce best practices through a
vast number of generic rules, and at the level of a single assembly,
Reference Inspector works on the relationships between assemblies to
enforce rules that are highly specific to that particular project.
Beta. Still working out the finer points of implementation. The
current rule language is very usable, however it would benefit from
less verbosity and more flexibility. If major changes in the rule
definition syntax are made, conversion tools will be available.
Download and Installation
The executable is available here.
No installation is required, but the .NET Framework version 2.0 or
above must be available.
Each system analysed by Reference Inspector requires a rules file,
by convention named ProjectName.ri.xml. This is an XML
document of the following form:
Assemblies matching IgnoreFrom rules
will be ignored. This is handy for third-party components that are
present in the binary deployment, or for unit test assemblies that
may violate layering rules in order to provide stub functionality.
References to assemblies matched by
IgnoreTo rules will not be checked. This is useful for libraries that
are referenced by most of the project.
The simplest rule – forbids any
of the assemblies in the From list to reference any of the assemblies
in the To list.
These rules control the outgoing
references of an assembly, and are the most useful for enforcing
These rules prevent references to
components that may be deprecated or require encapsulating behind
wrapper assemblies (e.g. to prevent widespread dependencies on
ReferenceInspector works by recursively searching for assemblies
in a specified directory. It is run from the command line with the
The results of the check are printed to the console, with the app
returning a non-zero exit code when rule violations are found.
If you'd like to suggest any improvements to Reference Inspector,
email the developers. Some of
the ideas so far are:
A CruiseControl.NET plugin
An FxCop plugin
Class/Namespace level analysis
An XSD for the rule file schema
Are you using Reference Inspector?
If so, we'd love to know! Email Nicholas
Blumhardt to be listed here.