Pipeline Confusion

If you have some concrete issues, please mention them or open an issue on GitHub. But do try to learn how to use it before doing that. I find the Pipeline Tool pretty stable and easy to use.

Content.Load no longer loads raw assets, but it should be used to load .xnb files. It’s not deprecated or anything.

The Pipeline Tool is a standalone thing, so when it builds assets it puts them (by default) in a bin folder where the .mgcb file is located. The .xnb files still need to be copied to your project bin folder somehow so you can access them in your game. However MonoGame offers an easy solution for that. MonoGame template projects import a .targets file in the .csproj that defines a build action for .mgcb files. It’s called MonoGameContentReference. When you set that on your .mgcb the assets it contains will automatically be built (if necessary) and copied to your project bin folder when you build your project. The location of the assets in the project bin folder is the same as the relative location of the .mgcb file in your project. I.e. if your .mgcb file is at {ProjectRoot}/Content/Content.mgcb then the MonoGameContentReference Build Action will copy the built .xnb files to {ProjectBin}/Content/{AssetLocation}.
A ContentManager has a property RootDirectory which - in the MG templates - is set to “Content” because the .mgcb file in the templates is in the {ProjectRoot}/Content folder.

So just a quick rundown of how to use the Pipeline Tool to load an image:

  • Start a new project from one of the MG templates
  • Open the .mgcb file using the Pipeline Tool
  • Add your image.png and save the .mgcb file
  • In you project load the image by doing var myImage = Content.Load<Texture2D>("image");
  • Build your project. This will do the other steps for you automatically because of the MonoGameContentReference build action.
    • The .mgcb file will be built. This will produce the .xnb for the image.
    • The .xnb file will be copied to your project output dir

This stuff is all explained in the docs by the way: http://www.monogame.net/documentation/?page=Using_The_Pipeline_Tool

EDIT
Just to clarify where a ContentManager expects content to be:
When loading a file called “image” (Content.Load<Texture2D>("image")) the ContentManager looks for the file at WorkingDir/RootDirectory/image.xnb. WorkingDir is the directory of your game executable, so that would be the bin/Platform/Debug/ folder usually. RootDirectory is the property of ContentManager. So when you start from a template and call Content.Load<Type>("fileName") the path is WorkingDir/Content/filename.xnb.

1 Like