I am attempting to tidy up a project by removing anything redundant from it. My issue is that there are many references and I am wondering is there a way I can see which namespaces link to any references so I can remove any references that are not used? Does this make sense if not ill try and rephrase? Any help is appreciated.
Asked
Active
Viewed 62 times
0
-
Dependency Walker shows all the dependent library.I think you can use this for. – jiten Jan 24 '14 at 11:05
-
Namespaces and references are *somewhat* orthogonal, in that many assemblies can contribute to the same namespace, and a single assembly can contribute to many namespaces. If you're looking for unused assembly references, perhaps NDepend can help? – Jon Skeet Jan 24 '14 at 11:06
-
Download the trial of this http://www.jetbrains.com/resharper/download/, it will just do that for you and you will come to love it – StackTrace Jan 24 '14 at 11:06
-
Cool cheers guys ill let you know how it goes – Srb1313711 Jan 24 '14 at 11:07
-
This is a great response to what's more-or-less the same question: http://stackoverflow.com/a/1382776/2150286 – pc-pdx Jan 24 '14 at 17:20
2 Answers
2
As pointed out by @SQL.NET Warrior you can easily remove unused references using Resharper. You just have to Right click on project -> Refactor->Remove unused references
Or you can use Visual studio extension - Remove Unused references written by Spongman
-
1Resharper is awesome, but be weary of removing 'unused' references - test! R# seems to consider a used reference one that gets called from a codebehind. A dll like Telerik controls that may be used only on a markup page or otherwise not referenced by code, will not trigger a reference use and be removed - which is a fail. Your project may still build in VS but will actually throw in use. I encourage using the [link](http://msdn.microsoft.com/en-us/library/ms227976(v=vs.90).aspx)aspnet compiler to do a precompile test[/link] before committing. test!test! – pc-pdx Jan 24 '14 at 17:18
1
Resharper can remove unused references and also can remove unused namespaces within files if you are brave enough to apply it from solution level.

Carbine
- 7,849
- 4
- 30
- 54

Tony Stark
- 781
- 6
- 22