Deleting “bin” & “obj” folders in a .NET solution.

Recently I ran into an issue where none of my breakpoints for my solution would get activated when I ran a pretty large .NET Core solution. I tried cleaning the project and rebuilding which did not work. I was even desperate enough to reboot my machine, that’s when I know I’m at the end of my tether.

Bash Solution

Since the project I’m working on is pretty big, going through all the directories manually is super tedious. I work on OSX so I needed something that works in bash and here is what I came up with.

I created a file in the solution’s root directory called I wrote the following in the file;

echo "Deleting all bin and obj folders..."
find . -iname "bin" -o -iname "obj" | xargs rm -rf
echo "Your bin and obj folders deleted!"

All that is left is to make the file executable with chmod +x Now we are all good to run the file by entering ./ in your terminal.

BAM! All your bin and obj files are a thing of the past.

BAT Solution

I found the following solution on Alper Ebiçoğlu’s post about the same issue. Basically do exactly the same as above but instead of using the .sh extension, use .bat.

@echo off@echo Deleting all BIN and OBJ folders…for /d /r . %%d in (bin,obj) do @if exist “%%d” rd /s/q “%%d”@echo BIN and OBJ folders successfully deleted :) Close the window.pause > nul

Double click the bat file and BAM! Victory!

Published by

Christopher Penkin

I have 16 years web and application development under my belt working on a wide range of different technologies including; C#, Python, Javascript, HTML & CSS, PostgreSQL, RabbitMQ and the AWS environment. My passion is to not just create great software, but great looking, easy to use software where the user is the central character of any solution.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.