Skip to content

Instantly share code, notes, and snippets.

@jburditt
Last active February 4, 2023 00:04
Show Gist options
  • Save jburditt/689219c73941100813756644a69497be to your computer and use it in GitHub Desktop.
Save jburditt/689219c73941100813756644a69497be to your computer and use it in GitHub Desktop.
Visual Studio Clean bin and obj Folders
<!-- Visual Studio 2022 -->
<!-- Put this in every csproj file -->
<Import Project="..\..\Tools\Cleanup.targets"/>
<!-- Tools\Cleanup.targets -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="DeleteBinAndObjFolders" AfterTargets="Clean"> <!-- common vars https://msdn.microsoft.com/en-us/library/c02as0cs.aspx?f=255&MSPPError=-2147217396 -->
<RemoveDir Directories="$(BaseOutputPath)" /> <!-- bin -->
<RemoveDir Directories="$(ProjectDir)$(BaseIntermediateOutputPath)" /> <!-- obj -->
</Target>
</Project>
<!-- Visual Studio 20 something version -->
<Target Name="DeleteBinAndObjFolders" AfterTargets="Clean">
<RemoveDir Directories="$(TargetDir)" /><!-- bin -->
<RemoveDir Directories="$(SolutionDir).vs" /><!-- .vs -->
<RemoveDir Directories="$(ProjectDir)$(BaseIntermediateOutputPath)" /><!-- obj -->
</Target>
<!--
Credit
https://stackoverflow.com/questions/1088593/how-to-clean-visual-studio-bin-and-obj-folders
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment