Easy Pak

EasyPak is a content packer for Xna. It is a fork Nick Gravelyn's EasyZip without the compression since Xna now compresses your files for you. EasyPak can reduce loading times by merging your content to minimize seek times. Loading the content requires minimal code changes.

How it works

EasyPakWriter is a MSBuild task that takes multiple files from your game's content folder and writes them to a single content.pak file. You can then create a PakContentManager at runtime which will load this .pak file. When you call PakContentManager.Load<T>(), your asset will be loaded from memory instead of from disk.


  • Build the EasyPakWriter solution. This uses a post-build event to copy the required DLLs to c:\EasyPak.
  • Copy the EasyPak project or the built DLL for your target platform into your solution folder and reference it.
  • Edit your project's .csproj file so the targets at the end look as below. Note the location of the EasyPakWriter.dll if you changed the first step:

  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets. -->
  <Target Name="BeforeBuild">
  <UsingTask TaskName="EasyPak.PakWriter" AssemblyFile="c:\EasyPak\EasyPakWriter.dll" />
  <Target Name="AfterBuild">
    <EasyPak.PakWriter OutDir="$(OutDir)" ContentDir="$(ContentDir)" PakName="$(PakName)" IncludeFolders="$(IncludeFolders)" ExcludeFolders="$(ExcludeFolders)" ExcludeExtensions="$(ExcludeExtensions)" />

Example Notes

  • Refer to the example file "TestGameX360 - EasyPak On.csproj" to see how EasyPak can split your content into multiple Pak files.
  • It loads a font and 300 tiny files split into 3 folders, each of which have a ContentManager (or PakContentManager).
  • On my Xbox, this loads in ~1100ms without EasyPak and ~550ms with EasyPak.
  • The example solution contains two projects to compare loading times when using and not using EasyPak. Since these projects refer to the same content files and output folders, to test them you need to:
    • Manually rebuild project
    • Manually deploy project before debugging
    • Be aware that Visual Studio does not know about output Pak files so they are not cleaned up by a rebuild

Last edited Mar 24, 2011 at 6:15 PM by roonda, version 5