Skip to content

Instantly share code, notes, and snippets.

@fcmendoza
Last active September 4, 2017 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fcmendoza/c436555063d3233b68332a2e46c39197 to your computer and use it in GitHub Desktop.
Save fcmendoza/c436555063d3233b68332a2e46c39197 to your computer and use it in GitHub Desktop.
Powershell script to "hard" rebuild a Visual Studio solution
cls
ECHO "Hard rebuilding 'Main' solution. Go get some coffee, this is going to take a few minutes ..."
$stopWatch = [system.diagnostics.stopwatch]::startNew()
ECHO "Cleaning solution ..."
devenv C:\Projects\Main.sln /clean
ECHO "Deleting remaining contents in bin folders ..."
C:\scripts\delete_bin_folders.bat
ECHO "Rebuilding solution ..."
devenv C:\Projects\Main.sln /rebuild Debug
$elapsedTime = [string]::Format("{0:0.0}", $stopWatch.Elapsed.TotalMinutes)
Write-Host "Hard rebuilding 'Main' solution done. Operation took" $elapsedTime "minutes. How was your coffee."
#Write-Host "This script took" $elapsedTime "minutes to complete."
set folder="C:\Projects\Main\UI\bin"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)
set folder="C:\Projects\Main\DataAccess\bin"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)
set folder="C:\Projects\Main\Api\bin"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment