Skip to content

Instantly share code, notes, and snippets.

@RhysC
Created October 30, 2015 03:33
Show Gist options
  • Save RhysC/a0c34ae3101745c1dca1 to your computer and use it in GitHub Desktop.
Save RhysC/a0c34ae3101745c1dca1 to your computer and use it in GitHub Desktop.
Make sure that each project can be built from a clean state (ie no rouge dlls from previous builds)
$ErrorActionPreference = "Stop"
function cleanBin {
param ([string]$path)
write-host "Cleaning bin from: $path"
get-childitem $path -include bin -recurse | remove-item -force -confirm:$false -recurse
write-host "Cleaning obj from: $path"
get-childitem $path -include obj -recurse | remove-item -force -confirm:$false -recurse
write-host "Cleaning csx from: $path"
get-childitem $path -include csx -recurse | remove-item -force -confirm:$false -recurse
write-host "Cleaning BuildOutput (no recursive search) from: $path"
get-childitem $path -include BuildOutput | remove-item -force -confirm:$false -recurse
}
$msbuild = "C:\\Program Files (x86)\\MSBuild\\12.0\\Bin\\MSBuild.exe"
Get-ChildItem *.csproj -Recurse |
ForEach-Object {
cleanBin
& $msbuild $_.Fullname /verbosity:quiet
if($lastexitcode){
exit $lastexitcode
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment