Powershell script for ASP.NET cleanup

Posts   
 
    
jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 14-Aug-2012 13:04:26   

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! smile

Attachments
Filename File size Added on Approval
Clean-ASP-NET-Files.txt 15,002 14-Aug-2012 13:05.04 Approved
Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 14-Aug-2012 19:37:40   

Haven't tested it, but it looks good.

Thanks for sharing, I believe others would find it very useful.