Skip to content

Instantly share code, notes, and snippets.

@DanRigby
Created May 4, 2012 03:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanRigby/2591628 to your computer and use it in GitHub Desktop.
Save DanRigby/2591628 to your computer and use it in GitHub Desktop.
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