Reference Assistant is free, open source tool to remove unused references from C#, F#, VB.NET or VC++/CLI projects in the Visual Studio 2010/11. It's developed in C#.
The original version targeted Visual Studio 2010-2013.
Often a .NET project has some references that are not used by any types of its project. When creates new project, the Visual Studio adds several assemblies by default. Types from these assemblies can be used in the future.
How to detect what assembly reference is useful and what is not? Simplest way checking the used types. But what if a project is so big? Well, it is possible to check an assembly manifest. Yes, assemblies references which are required for runtime will be included in the manifest. But there is one more problem. The assembly can be required indirectly. For example, if you use some type then all assemblies containing definitions of its base types (classes and interfaces from type's hierarchy) should be in a project's references. It is just one example.
The Reference Assistant checks several criterions to decide to remove assembly reference or not:
- checks a project assembly's manifest (for VC++/CLI doesn't check);
- checks the hierarchy of used classes;
- checks the hierarchy of used interfaces;
- checks the used attributes and their parameters types;
- checks the forwarded types (some type can be moved from one assembly to another);
- checks the imported types (e.g. COM types);
- checks the used members of types (methods, properties, fields, events) and them parameters types;
- checks the types declared in XAML (Silverlight, WPF, Workflow 4.0, Windows Phone)
The Reference Assistant uses the Mono.Cecil package for reading assembly metadata.
The Reference Assistant is available for downloading under the repository's Releases
Original versions of the Reference Assistant can be found on the Visual Studio Gallery:
If you want to change the Reference Assistant's source code for yourself and to compile it after that, you need to install the Visual Studio extension development workload in Visual Studio 2017 under Tools
> Get Tools and Features
.