Content File Not Found on Template Build

I am following the Monogame setup documentation guide.
I have a clean install of VS Community 2022. The Monogame templates are installed. I create a new OpenGL project and add a simple Texture2D. I add a .png file through the MGCB Editor and build. I build and run my project, and the .png file I just added cannot be found.

public class Game1 : Game
    {
        private GraphicsDeviceManager _graphics;
        private SpriteBatch _spriteBatch;
        Texture2D title;

        public Game1()
        {
            _graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            IsMouseVisible = true;
        }

        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            base.Initialize();
        }

        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            title = Content.Load<Texture2D>("title");
        }


In the bin folder there isn’t even a Content folder, much less a title.xnb file.
MGCB Editor Build Action is set to ‘MonoGameContentReference’
‘title.png’ in the solution explorer is set to Build Action ‘none’ and Do not Copy, and even if I change these to Build Action Content and Copy if newer, it just copies the .png and doesn’t build as an .xnb file so I get the same error.

Any help with this?

Check the compiled file on the disk. Perhaps MGCB has a different way to exit compiled files.

Unfortunately I’m not quite sure what you mean by this. There is a title.png file in the Content folder of the project, but no title.xnb in the Debug/bin folder. Could you elaborate a bit on what I should check?


Change the output path

1 Like

This worked! Thank you so much, this caused me so much headache.