Skip to content
The MonoGame.RuntimeBuilder builds your raw content asynchronously to the .XNB format during runtime.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Welcome to the MonoGame.RuntimeBuilder!

Twitter Follow NuGet

The MonoGame.RuntimeBuilder builds your raw content asynchronously to the .XNB format during runtime.

This library is a part of the MonoGame.Forms project, but it is fully usable without the MonoGame.Forms library!

Sample Project


Using the MonoGame.RuntimeBuilder is fairly easy:

// Creating the property.
private RuntimeBuilder _RuntimeBuilder { get; set; }

// Initialize the RuntimeBuilder.
_RuntimeBuilder = new RuntimeBuilder(
                Path.Combine(Application.StartupPath, "working"),           // working directory
                Path.Combine(Application.StartupPath, "working", "obj"),    // intermediate directory
                Path.Combine(Application.StartupPath, "Content"),           // output directory
                TargetPlatform.Windows,                                     // target platform
                GraphicsProfile.Reach,                                      // graphics profile
                true)                                                       // compress the content
                Logger = new StringBuilderLogger()                          // logger
// Pick Files & Build Content.
private async void ButtonPickFiles_Click(object sender, System.EventArgs e)
    if (openFileDialog.ShowDialog() == DialogResult.OK)
        await _RuntimeBuilder.BuildContent(openFileDialog.FileNames);

And... that's it!

A content build list will be generated for you so that in case you just want to rebuild your files, you simply need to call _RuntimeBuilder.BuildContent(); (without parameters) again.

The RuntimeBuilder.cs class is actually just a wrapper around the original MGCB tool, so it contains all of its features and functionality. Take a look at it and you will see that everything is pretty self-explanatory.

Just one note:

To get log information you need to use a ContentBuildLogger. You can also inherit from this class to build your own logger.

Fortunately this library already contains a StringBuilderLogger as an example :)

There is generally a sample project included in this repo, which shows pretty much everything. It's fully documented (comments) as well as the most important parts of the library.

Now Have Fun with the MonoGame.RuntimeBuilder!

Twitter Follow


You can’t perform that action at this time.