MonoGame.RuntimeBuilder 2.4.0

dotnet add package MonoGame.RuntimeBuilder --version 2.4.0                
NuGet\Install-Package MonoGame.RuntimeBuilder -Version 2.4.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MonoGame.RuntimeBuilder" Version="2.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MonoGame.RuntimeBuilder --version 2.4.0                
#r "nuget: MonoGame.RuntimeBuilder, 2.4.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MonoGame.RuntimeBuilder as a Cake Addin
#addin nuget:?package=MonoGame.RuntimeBuilder&version=2.4.0

// Install MonoGame.RuntimeBuilder as a Cake Tool
#tool nuget:?package=MonoGame.RuntimeBuilder&version=2.4.0                

Banner

Welcome to the MonoGame.RuntimeBuilder!

Version

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


Tutorial

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)
    {
        _RuntimeBuilder.RegisterBuildContent(openFileDialog.FileNames);
        await _RuntimeBuilder.BuildContent();
    }
}

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!

Logo

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.4.0 102 3/20/2025
2.3.0 138 3/12/2025
2.2.0 160 3/9/2025
2.1.0 128 3/8/2025
2.0.0 201 3/7/2025
1.0.0 1,219 9/8/2019