I ran into an issue over the past few days where Visual Studio was telling me that I had two different versions of the same reference. The eventual fix was to delete all of the bin folders from the solution and rebuild.
I decided to write a Powershell script to do this from Visual Studio > Tools > External Tools. The script will also clear all of the known locations for temp files, reflected assemblies, etc. It has been tested on Windows XP and Windows 7 x64 and with .NET 2/.NET 4.
A few notes on usage:
Save the attached file as a Powershell script file.
If you're running x64, be sure to enable the x86 console or use the powershell path to the x64 powershell.exe in the External tools setup.
Add as an external tool in Visual Studio.
Visual Studio > Tools > External Tools.
Command:
powershell.exe
Arguments: (Change the path below to match your local path to this script.)
-file "$(SolutionDir)Tools\Clean-ASP-NET-Files.ps1" "$(SolutionDir)"
Initial Directory:
$(SolutionDir)
Uncheck "Use Output Window" and Check "Close on exit"
Enjoy!