I work with multiple projects, and I want to recursively delete all folders with the name \'bin\' or \'obj\' that way I am sure that all projects will rebuild everything (so
I use a slight modification of Robert H which skips errors and prints the delete files. I usally also clear the .vs
, _resharper
and package
folders:
Get-ChildItem -include bin,obj,packages,'_ReSharper.Caches','.vs' -Force -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse -ErrorAction SilentlyContinue -Verbose}
Also worth to note is the git
command which clears all changes inclusive ignored files and directories:
git clean -dfx
Is 'clean' not good enough? Note that you can call msbuild with /t:clean from the command-line.
This Works Fine For Me: start for /d /r . %%d in (bin,obj, ClientBin,Generated_Code) do @if exist "%%d" rd /s /q "%%d"
This worked for me:
for /d /r . %%d in (bin,obj) do @if exist "%%d" rd /s/q "%%d"
Based on this answer on superuser.com
I think you can right click to your solution/project and click "Clean" button.
As far as I remember it was working like that. I don't have my VS.NET with me now so can't test it.
To delete bin and obj before build add to project file:
<Target Name="BeforeBuild">
<!-- Remove obj folder -->
<RemoveDir Directories="$(BaseIntermediateOutputPath)" />
<!-- Remove bin folder -->
<RemoveDir Directories="$(BaseOutputPath)" />
</Target>
Here is article: How to remove bin and/or obj folder before the build or deploy