I suggest you ...

Remove unused References

It would be great to have an option to remove all unused References from a project.
Similar to [Organize Usings] > [Remove and Sort].

240 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    teusje shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    7 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • verelpode commented  ·   ·  Flag as inappropriate

        In addition to removing unused references (to assemblies), I wish that the C# compiler would remove unused code/classes/methods from the final app or .exe file. If you use a large library in an app, but the app uses only a small portion of the library, the entire library is included in the final app anyway. I wish that the final compiled app/exe contained only the references and classes that are truly used in the app.

        For example, it is a big maintenance hassle to manually remove 60 unused classes and retain the 5 classes that are actually used in a particular app.

      • Mike commented  ·   ·  Flag as inappropriate

        This is needed. Too many of these suggestions are met with answers saying to download a plug-in. The problem with plug-ins is that they aren't always kept up-to-date from one VS version to another (just look at Code Contracts). And many companies are becoming even more paranoid about letting their employees download software from the Internet because of malware and legal concerns. A simple feature like this should just be "baked in".

      • Anonymous commented  ·   ·  Flag as inappropriate

        I would like the same behaviour than "Importing namespaces" in a file which are in gray (Visual Studio 2017) if the namespace is not used.

        So, the name of the Reference (dll) also in gray if it is not used.

      • Clayton commented  ·   ·  Flag as inappropriate

        If VS does this for usings, I think it's only natural they do this for references as well. The add-in you mention doesn't cover VS2013. Is there something for that?

      Feedback and Knowledge Base