Created
June 25, 2025 16:34
-
-
Save swax/6fff14be5042a1ebaeba3d154551b282 to your computer and use it in GitHub Desktop.
Example of deleting folders with MSBuild
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<Target Name="CleanupDashDirs" AfterTargets="Publish"> | |
<ItemGroup> | |
<DashFiles Include="$(PublishDir)..\**\*-*\**" Exclude="**\*en-us*\**" /> | |
<DashDirs Include="@(DashFiles->'%(RootDir)%(Directory)')" /> | |
<!-- Remove duplicates --> | |
<UniqueDashDirs Include="@(DashDirs->Distinct())" /> | |
</ItemGroup> | |
<Message Importance="High" Text="PublishDir = $(PublishDir)" /> | |
<Message | |
Importance="High" | |
Text="🗑️ CleanupDashDirs: will remove these dirs -> @(UniqueDashDirs)" /> | |
<RemoveDir Directories="@(UniqueDashDirs)" /> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment