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?