Remove unused js and css files from existing visual studio project

SBirthare picture SBirthare · Mar 27, 2014 · Viewed 12.5k times · Source

For a new development project, I started with MVC4 template in VS2012. I also added few more Nuget packages, js and css. Admittedly made a mistake to considered the source as starting point for new project rather than starting with empty project.

I am considering cleaning up unwanted files (NuGet references, js, css, images, etc) as technical debt which I would like to tackle in current sprint.

Thinking what should be the most efficient approach, I searched and found many gentlemen has already faced this situation:

  1. For images
  2. For css
  3. For references

I have read the suggestions and it seems first they are old, second there is no single solution but we have to employ different tools for different type of file e.g. css, image.

Since I am using Resharper 8.1, I checked if it comes to rescue. It provides a solution level Code Cleanup dialog box which is useful however it is mostly limited to formatting (and a bit FxCop related stuff).

I am curious if someone has faced and solved this challenge recently (with some tool preferably)?

Is there any new tool that can be employed for this task?

If no tool available, how would you go about it?

Answer

NickNo picture NickNo · Nov 25, 2014

There is a free extension called Code Maid that "is an open source Visual Studio extension to cleanup, dig through and simplify our C#, C++, F#, VB, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding." I believe this is what you are looking for, as it has lots of functionality.

UPDATE 9/2015:

A new free extension (released 7/2015) is out that removes orphans / unused files: Find Unused Files