Monogame Content Pipeline: Diagnosing Missing .xnb Files After Build
Why MonoGame builds succeed but produce no .xnb files, and how to align your content project’s target framework with MonoGame.Content.Builder.
16 Mar 2026, 22:28 UTC

The problem: a successful build with no .xnb output
You add a PNG or WAV file to a MonoGame content project, run Rebuild, and the build reports success. When the game starts, Content.Load<Texture2D>("player") throws FileNotFoundException. Inspecting the output folder shows no .xnb file matching the asset.
Useful takeaway: this is usually a build-time mismatch, not a missing runtime file. The MonoGame Content Builder (MGCB) silently skipped compilation because the content project’s target framework does not match the version expected by the installed MonoGame.Content.Builder package.
Terms: .xnb is MonoGame’s compiled binary content format. MGCB (MonoGame Content Builder) converts source assets such as PNGs into .xnb files. A target framework moniker (TFM) such as net6.0 tells the SDK which .NET runtime a project compiles for.
Recognizable condition
- Build completes with exit code 0.
- Output directory contains no
.xnbfiles for assets listed incontent.mgcb. - Game crashes on
Content.LoadwithFileNotFoundExceptionor a similar content resolution failure.
Common causes and first checks
| Observed symptom | Likely cause | First check |
|---|---|---|
| No .xnb files; build succeeds | Target framework mismatch between content project and MonoGame.Content.Builder | Compare TargetFramework in the content project file with the package’s required framework |
| No .xnb files; MGCB errors in output | Invalid importer/processor or missing asset reference in content.mgcb | Inspect build output for MGCB warning or error lines |
| Old .xnb files present, new assets missing | Stale bin or obj output | Delete bin and obj, then rebuild |
| Asset not copied to output | Wrong MSBuild item type or build action | Verify content items use MonoGameContentReference |
Ordered checks
- Confirm the missing output. Open the content project’s build output folder, typically
bin\<Configuration>\<TargetFramework>\Content\. Look for a file named after your asset with a.xnbextension. - Inspect the build log. Run a rebuild from a terminal in the content project directory:
dotnet build <content-project.csproj> --rebuild
# or
msbuild /t:Rebuild <content-project.csproj>
Where to run: terminal or Developer Command Prompt, in the folder containing the content project. Permissions: ordinary user account with write access to the project folder; no administrator rights required unless you must install an SDK.
Expected check: look for lines containing MGCB, MonoGame.Content.Builder, or error codes such as MSB3073. If the builder exits without logging Built asset lines, compilation did not occur.
Risk: a rebuild overwrites previous output but does not delete source assets.
- Check the target framework. Open
<content-project>.csprojand findTargetFramework:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>
Version assumption: MonoGame 3.8 or later generally expects .NET 6 or later for the content builder package. Older MonoGame projects may target .NET Framework or .NET Core 3.1 and can fail under newer builder packages.
Compare this with the MonoGame.Content.Builder package version referenced by the project. A mismatch—such as content targeting net472 while the builder package requires .NET 6—is a common cause of silent .xnb omission.
- Verify item type. In the same project file, confirm content entries look like:
<ItemGroup>
<MonoGameContentReference Include="Content\\player.png">
<Importer>TextureImporter</Importer>
<Processor>TextureProcessor</Processor>
</MonoGameContentReference>
</ItemGroup>
If assets use None or Content instead of MonoGameContentReference, MGCB will not compile them.
- Clean stale output. Delete
binandobjunder the content project, then rebuild. Stale intermediate files can make the builder skip up-to-date checks incorrectly.
Fixes tied to findings
1. Align target frameworks
If the content project targets an older framework than the builder package expects, edit the project file:
<TargetFramework>net6.0</TargetFramework>
Then restore packages:
dotnet restore <content-project.csproj>
Rebuild and check for .xnb files. Do not manually copy .xnb files between projects; the runtime reader expects compiled metadata produced by MGCB, not a copied file with the right extension.
2. Correct the build action
If assets lack MonoGameContentReference, add them manually or use the MGCB editor to re-import the asset, which regenerates the correct importer and processor settings.
3. Clean and rebuild
dotnet clean <content-project.csproj>
dotnet build <content-project.csproj> --rebuild
Risk: cleaning removes all build output for that project. Source assets are unaffected.
4. Repair .mgcb references
Open content.mgcb in the MGCB editor. Confirm each asset appears in the content tree and points to an existing source file. Remove entries for deleted files, then save and rebuild.
Practical verification
- Check the output folder for
<asset-name>.xnbwith a timestamp after the rebuild. - Run a verbose MGCB compile directly:
MGCB.exe /c <path-to-content.mgcb> /verbose
Where to run: directory containing MGCB.exe, typically inside the MonoGame tools or NuGet package folder. Expected check: successful compile logs lines such as Built asset: player -> ...\player.xnb. If no such line appears, the asset was not compiled.
- Runtime test: in game code, call
Content.Load<Texture2D>("player")using the asset name without extension. Absence ofFileNotFoundExceptionconfirms resolution.
Escalation criteria
Escalate when:
- The content project and game project target different frameworks and migrating one breaks the other.
- MGCB exits with an error not resolved by framework alignment or cleaning.
- You are on MonoGame 3.8 or later and an older .NET Framework project refuses to build with the current builder package.
- Verbose MGCB output shows missing importers or processors that reinstalling
MonoGame.Content.Builderdoes not fix.
When escalating, include the content project file, the content.mgcb file, the MonoGame package version, and the full rebuild log.
Limitations
This guide covers missing .xnb files caused by build configuration. It does not cover runtime content root path problems, missing Content.RootDirectory assignment, or assets excluded by platform-specific content conditions. Verify the result by checking for the .xnb file and loading the asset at runtime before assuming the pipeline is healthy.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.