How can I find and delete unused references in my projects?
I know you can easily remove the using statements in vs 2008, but this doesn't remove the actual reference in your projects. The referenced dll will still be copied in your bin/setup package.
I think that are copied in bin\, because in the project that removed the reference have reference o other project that have the same reference...
If you know which references are not used you can remove them manually.
In Solution Explorer, right-click the reference in the References node, and then click Remove.
Removing unused references is a feature Visual Studio 2008 already supports. Unfortunately, only for VB .NET projects.
I have opened a suggestion on Microsoft Connect to get this feature for C# projects too:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=510326
If you like this feature as well then you might vote my suggestion.
Given that VisualStudio (or is it msbuild?) detects unused references and doesn't include them in the output file, you can write a script which parses the references out of the csproj, and compares that with the referenced Assemblies detected by reflexion on the project output.
If you're motivated...
I have a free answer that works in any version of Visual Studio and any Framework version. It doesn't remove the unused references, but it identifies them.
You can use Telerik JustDecompile on your project dll. Just open the dll in JustDecompile and go under
References
to see what is actually used in the compiled dll.I done this without extension in the VS 2010 Ultimate Architecture->Generate Dependency Graph->By Assembly, it shows used assemblies, and manually removed unused references.