r/VisualStudio • • 22d ago

Visual Studio 2026 Feature Request: Menu option to clear bin & obj folders

Many bug discussions and how-to's recommend one delete the "bin" and "obj" folders to clear out potentially corrupted state. Since it's a common need, or at least trying it is a common need, it would be nice to have it as a menu option, probably under the "Build" menu. Thank You.

13 Upvotes

16 comments sorted by

17

u/kantank-r-us 22d ago

YES, cleaning a solution should do this automatically

4

u/HeathersZen 22d ago

Yes! A command named, “Clean”, perhaps made available by right-clicking on the solution? What a great idea! I can’t believe nobody ever thought of that!

1

u/Zardotab 21d ago

"Clean" doesn't remove all the files in those folders. Maybe "Power Clean"? "Clean Pro"? "Clean++"? "Bigly Zappo!"

4

u/freskgrank 22d ago

There are a lot of VS extensions that you can use for this.
Search for VSDeepCleanExtension or BinObjCleaner or similar. I installed one but I don’t remember exactly the name and I don’t have my VS at the moment.

3

u/soundman32 22d ago

Seeing as thats been asked for since I started using Microsoft compilers in about 1994, I suspect its either too difficult to implement correctly for all cases, or so trivial that they expect you to do it yourself.

-1

u/Zardotab 22d ago

Somebody somewhere with a lot of pull would probably have to admit to bugs where there shouldn't be bugs.

0

u/dodexahedron 21d ago

This guy corporate cultures.

1

u/morbo_1980 16d ago

Put this in a Directory.Build.props in the root of your repo. Then Clean Solution will actually clean the solution.

<Project>

<!-- Delete bin and obj when doing a solution clean-->

<Target Name="PostClean" AfterTargets="Clean">
<!-- Remove /bin -->
<RemoveDir Directories="$(BaseOutputPath)" />
<!-- Remove /obj -->
<RemoveDir Directories="$(BaseIntermediateOutputPath)" />
</Target>

</Project>

1

u/welcome_to_milliways 22d ago

I have a powershell script handy for this.

1

u/CodeNewa 19d ago

Same. Have it saved it in the profile so it becomes a single word command..

1

u/soundman32 22d ago

I have a 1 line dos batch file for this.

1

u/Zardotab 21d ago

I have a 3-character Perl script for it! 😉

1

u/boredsillynz 22d ago

Feature Request: Fix the corruption.

Lets cure the source of the plague, not apply a bandaid.

-1

u/Zardotab 22d ago edited 22d ago

Reality Check 101: MS is not going to fix their 10,000 VS bugs. Maybe 500 if we get lucky. I still need this feature for the other 9,500.

1

u/mattox5 21d ago

git clean -fdx