<p>How can I find and delete unused references in my projects?  </p>

<p>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.</p>

[{'answer_id': 81610, 'author': 'Chris Canal', 'author_id': 5802, 'author_profile': 'https://Stackoverflow.com/users/5802', 'pm_score': 2, 'selected': False, 'text': '<p><a href="https://www.jetbrains.com/resharper/" rel="nofollow noreferrer">ReSharper</a> will do this for you (and so so much more!)</p>\n'}, {'answer_id': 228834, 'author': 'Benjol', 'author_id': 11410, 'author_profile': 'https://Stackoverflow.com/users/11410', 'pm_score': 0, 'selected': False, 'text': "<p>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.</p>\n\n<p>If you're motivated...</p>\n"}, {'answer_id': 1382776, 'author': 'jlo', 'author_id': 48148, 'author_profile': 'https://Stackoverflow.com/users/48148', 'pm_score': 7, 'selected': True, 'text': '<p>*Note: see <a href="http://www.jetbrains.net/devnet/message/5244658" rel="noreferrer">http://www.jetbrains.net/devnet/message/5244658</a> for another version of this answer.</p>\n\n<p>Reading through the posts, it looks like there is some confusion as to the original question.  Let me take a stab at it.</p>\n\n<p>The original post is really asking the question: "How do I identify and remove references from one Visual Studio project to other projects/assemblies that are not in use?"  The poster wants the assemblies to no longer appear as part of the build output. </p>\n\n<p>In this case, ReSharper can help you <em>identify</em> them, but you have to <em>remove</em> them yourself.  </p>\n\n<p>To do this, open up the References inth Solution Browser, right mouse click on each referenced assembly, and pick "Find Dependent Code".  See:</p>\n\n<p><a href="http://www.jetbrains.com/resharper/features/navigation_search.html#Find_ReferencedDependent_Code" rel="noreferrer">http://www.jetbrains.com/resharper/features/navigation_search.html#Find_ReferencedDependent_Code</a></p>\n\n<p>You will either get:</p>\n\n<ol>\n<li><p>A list of the dependencies on that Reference in a browser window, or</p></li>\n<li><p>A dialog telling you "Code dependent on module XXXXXXX was not found.".</p></li>\n</ol>\n\n<p>If you get the the second result, you can then right mouse click the Reference, select Remove, and remove it from your project.</p>\n\n<p>While you have to to this "manually", i.e. one reference at a time, it will get the job done.  If anyone has automated this in some manner I am interested in hearing how it was done.</p>\n\n<p>You can pretty much ignore the ones in the .Net Framework as they don\'t normally get copied to your build output (typically - although not necessarily true for Silverlight apps).</p>\n\n<p>Some posts seem to be answering the question: "How do I remove using clauses (C#) from a source code file that are not needed to resolve any references within that file".  </p>\n\n<p>In this case, ReSharper does help in a couple ways:</p>\n\n<ol>\n<li><p>Identifies unused using clauses for you during on the fly error detection.  They appear as Code Inspection Warnings - the code will appear greyed out (be default) in the file and ReSharper will provide a Hint to remove it: </p>\n\n<p><a href="http://www.jetbrains.com/resharper/features/code_analysis.html#On-the-fly_Error_Detection" rel="noreferrer">http://www.jetbrains.com/resharper/features/code_analysis.html#On-the-fly_Error_Detection</a></p></li>\n<li><p>Allows you to automatically remove them as part of the Code Cleanup Process:</p>\n\n<p><a href="http://www.jetbrains.com/resharper/features/code_formatting.html#Optimizing_Namespace_Import_Directives" rel="noreferrer">http://www.jetbrains.com/resharper/features/code_formatting.html#Optimizing_Namespace_Import_Directives</a></p></li>\n</ol>\n\n<p><strong>Finally, realize that ReSharper does static code analysis on your solution.  So, if you have a dynamic reference to the assembly - say through reflection or an assembly that is dynamically loaded at runtime and accessed through an interface - it won\'t pick it up.</strong>  There is no substitute for understanding your code base and the project dependencies as you work on your project.  I do find the ReSharper features very useful.</p>\n'}, {'answer_id': 1729352, 'author': 'jbe', 'author_id': 103988, 'author_profile': 'https://Stackoverflow.com/users/103988', 'pm_score': 3, 'selected': False, 'text': '<p>Removing unused references is a feature Visual Studio 2008 already supports. Unfortunately, only for VB .NET projects.</p>\n\n<p>I have opened a suggestion on Microsoft Connect to get this feature for C# projects too:</p>\n\n<p><a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=510326" rel="noreferrer">http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=510326</a> </p>\n\n<p>If you like this feature as well then you might vote my suggestion.</p>\n'}, {'answer_id': 5961469, 'author': 'Spongman', 'author_id': 204555, 'author_profile': 'https://Stackoverflow.com/users/204555', 'pm_score': 4, 'selected': False, 'text': '<p>you can use the \'<strong>Remove Unused References</strong>\' extension I wrote: </p>\n\n<p><a href="http://visualstudiogallery.msdn.microsoft.com/9811e528-cfa8-4fe7-9dd1-4021978b5097">http://visualstudiogallery.msdn.microsoft.com/9811e528-cfa8-4fe7-9dd1-4021978b5097</a></p>\n'}, {'answer_id': 8133979, 'author': 'Kirill Skrygan', 'author_id': 185103, 'author_profile': 'https://Stackoverflow.com/users/185103', 'pm_score': 2, 'selected': False, 'text': '<p>ReSharper 6.1 will include these features:</p>\n<ul>\n<li><p><strong>Optimize references</strong>: analyze your assembly references and their usages in code, get list of redundant references and remove them.</p>\n</li>\n<li><p><strong>Remove Unused References</strong>: quick refactoring to remove redundant assembly references.</p>\n</li>\n<li><p><strong>Safe delete on assembly references</strong>: will delete assembly references if all of them are redundant, otherwise dispalies usages and can remove only redundant assembly references of the selected list.</p>\n</li>\n</ul>\n'}, {'answer_id': 9154751, 'author': 'Leniel Maccaferri', 'author_id': 114029, 'author_profile': 'https://Stackoverflow.com/users/114029', 'pm_score': 3, 'selected': False, 'text': '<p>Try this one: <a href="http://visualstudiogallery.msdn.microsoft.com/fc504cc6-5808-4da8-ae86-8d3f9ed81606" rel="noreferrer">Reference Assistant</a></p>\n\n<blockquote>\n  <p>Summary</p>\n  \n  <p>Reference Assistant helps to remove unused references from C#, F#,\n  VB.NET or VC++/CLI projects in the Visual Studio 2010.</p>\n</blockquote>\n'}, {'answer_id': 13108045, 'author': 'mes', 'author_id': 1016092, 'author_profile': 'https://Stackoverflow.com/users/1016092', 'pm_score': 2, 'selected': False, 'text': '<p>I done this without extension in the VS 2010 Ultimate\nArchitecture->Generate Dependency Graph->By Assembly, it shows used assemblies, and manually removed unused references.</p>\n'}, {'answer_id': 27364730, 'author': 'hdmq', 'author_id': 3792118, 'author_profile': 'https://Stackoverflow.com/users/3792118', 'pm_score': 0, 'selected': False, 'text': '<p>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...</p>\n'}, {'answer_id': 32232580, 'author': 'toddmo', 'author_id': 1045881, 'author_profile': 'https://Stackoverflow.com/users/1045881', 'pm_score': 2, 'selected': False, 'text': '<p>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.</p>\n\n<p>You can use <a href="http://www.telerik.com/products/decompiler.aspx" rel="nofollow noreferrer">Telerik JustDecompile</a> on your project dll. Just open the dll in JustDecompile and go under <code>References</code> to see what is actually used in the compiled dll.</p>\n\n<p><a href="https://i.stack.imgur.com/Lc9BT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lc9BT.png" alt="enter image description here"></a></p>\n'}, {'answer_id': 34355618, 'author': 'fat', 'author_id': 1035174, 'author_profile': 'https://Stackoverflow.com/users/1035174', 'pm_score': 0, 'selected': False, 'text': '<p>If you know which references are not used you can remove them manually.<br>\nIn Solution Explorer, right-click the reference in the <em>References</em> node, and then click Remove. </p>\n'}]
['https://Stackoverflow.com/questions/81597', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/11333/']