3.4: Added VS2017 install paths for latest MSBuild support3.3: Fixed regression bug, project references not being cleaned.3.2: VS 2017 release, bug fix for no package config case.What's new with 3.1Having non-destructive edits to projects being resolved for unused references is now possible.
NOTE: The tool is not tested to work with DotNet Web projects(Asp.Net, MVC), Windows CE, Silverlight project types. Use it at your own risk. If you can, test and contribute by opening an issue here. What does it do? This tool removes the unused assembly and project references in Visual Studio Projects as well as NuGet package references and deletes unused package folders.
Now features a progress dialog with cancel button as well as status bar update in Visual Studio! What are the benefits?
What versions of project templates, project types are supported? Works for VS2012/2013, have not tested for the older version. As long as .proj XML remains same, should work. Ironically, VS Extension/Package project template type don't build in a traditional way with MSBuild and hence not supported, yet. How does it work? On installing the extension, a menu is added to both solution and project node items in the all too familiar Solution Explorer tool window with not so unusual name - "Remove Unused References" Just click the menu item, solution level operation removes references for all projects in the solution and project menu removes... you know what! What's happening underneath? For every project, one of the reliable ways of checking the validity of a reference is to remove a reference and see if it compiles without errors. Errors mean reference removed was in use. Steps:
Of course, the project might have build errors prior to reference removal which is a case handled by the extension. You'll receive a message in this case. What are some things to be wary about? If you are running on a large project which already takes a while to compile, hit the menu command and go grab a coffee or something. Build runs as many times as a number of project references and Visual Studio might be unresponsive. Progress dialog has a cancel button to cancel the removal operation should you choose to abort at some point. Also, exercise safety practices before running the tool like having source files checked into source control so you can revert changes if something goes wrong. What about MSBuild version? Which version does the tool pick? The tool is configured to check MSBuild versions on local machine starting at 64-bit v4.0, x86 v4.0 on to v3.5 and v2.0 on both platforms. For more info check out the source. I don't like my Visual Studio freeze up on big projects. What are the alternatives? Console app can be installed. Or if you'd like to build for custom .net framework/platform, head to the source link above, compile the console app and run it at the command line. Instructions are over there as well. How do I report bugs? Congratulations, you found a bug! Please report here on Q & A. How can I contribute? Please vote and publicize this so it can be improved. Feel free to update source with anything you have in mind and make a pull request. Release Notes: v3.3: Fixed regression bug, project references not being cleaned. v3.2: VS 2017 release, bug fix for no package config case. v3.1: Added NuGet packages marked as development dependency to be excluded v3.0: Updated with a preview mode allowing exclusion and final confirmation before removal of references v2.3: Version release for VS 2015 v2.2: Make package removal optional until an exclusion list based removal is implemented v2.1: Removes NuGet references as well v1.3: Better console messages. Fix minor bugs v1.0: First release |