Table of Contents

Cleaning up

Beginner

The build process generates additional files that aren't necessary for the game to work. This page explains how to clean them up in order to not clutter your game's files.

Files to delete

  • Empty folders - sometimes created by the build process.
  • .pdb files - information used for debugging.
  • .xml files - the generated code documentation.

Automatic cleanup

You can setup the build process to automatically delete the unnecessary files after publishing. Just add the below to the .csproj file of the platform package.

<Project Sdk="Microsoft.NET.Sdk">
    
    ...
    
    <Target Name="CleanupPublish" AfterTargets="Publish">
        <ItemGroup>
            <FilesToCleanup Include="$(PublishDir)/*.xml;$(PublishDir)/*.pdb"/>
        </ItemGroup>
        <Delete Files="@(FilesToCleanup)"/>
    </Target>
</Project>

Explanation
After you publish the game, the Cleanup Publish target will be executed. It first defines a list of .xml and .pdb files located in the publish directory and stores them in a new property called FilesToCleanup. Then the Delete task goes over that list and deletes all of it's items.

See also