Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Handling compiled content files (*.xnb) for an XNA/MonoGame codebase
  • Create a folder named Content under the Project Folder.

  • Add to the XNA Windows project file:

    <PropertyGroup>
        <PostBuildEvent>xcopy "$(ProjectDir)$(OutDir)Content\*.*" "$(ProjectDir)Content" /S /I /R /Y</PostBuildEvent>
    </PropertyGroup>
  • Add to the MonoGame project file:
    <Content Include="Content\\**\*.xnb">
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  • Add to .gitignore:
    *.xnb
  • Add new file (ProjectFolder)\Content\ReadMe.txt:
    The compiled XNB content files should be automatically copied into this folder when doing an XNA Windows build.
    These files are necessary to build and run the MonoGame version of the application.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment