# MonoGame does not generate xnb from png

I am coming straight from XNA and I installed the latest version of MonoGame today (2015-12-22) for Visual Studio 2015 Community. I created a project from the windows Project template.

I right click the content folder and add a png-file. I compile without error but it stops during runtime because it can't find the content file. My solution look like this

Game1.cs look like this:

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace homer
{
public class Game1 : Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
private Texture2D simpson;

public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}

protected override void Initialize()
{
base.Initialize();
}

{
spriteBatch = new SpriteBatch(GraphicsDevice);
}

protected override void Update(GameTime gameTime)
{
if (Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
base.Update(gameTime);
}

protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);
spriteBatch.Draw(simpson, new Vector2(200, 100), Color.White);
spriteBatch.End();
base.Draw(gameTime);
}
}
}


The problem I encounter is that MonoGame do not make xnb-files from the png and put it in my output folder. I tried to copy the file manually from a compiled XNA project to my MonoGame debug folder and it worked. I have done nothing but create a project from the template and trying to load an image. What do I need to do to make MonoGame compile xnb-files for me. It also runs if I change "Do not copy" to "Copy always" but that is not optimal for runtime as I understand it. Also, I don't want it to be too easy for the users to doodle in the graphics.

Content.mgcb look like this

#----------------------------- Global Properties ----------------------------#

/outputDir:bin/Windows
/intermediateDir:obj/Windows
/platform:Windows
/config:
/profile:Reach
/compress:False

#-------------------------------- References --------------------------------#

#---------------------------------- Content ---------------------------------#


Open the Content.mgcb file with the ContentPipeline tool. From there you can add the .png file and the content will be build for you.

The content pipeline tool is located on my machine in: "C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\Pipeline.exe"

• Worked like a charm. Do I need to do this for every single file in a project? It feels a little redundant to having to add every file twice, first in visual studio and then in the pipeline editor. – Lord Wolfenstein Dec 22 '15 at 20:34
• You can add files in the pipeline tool (even create folders to organise content). So instead of adding them to your project, add them here in stead. – Felsir Dec 22 '15 at 20:36
• I tried to add things just in the Pipeline editor but that do not work for me. I must add it both in the project and in Pipeline for it to get to the output folder. – Lord Wolfenstein Jan 1 '16 at 23:13
• That's weird. The pipeline builds the content. The only thing I could think of is that the builder otherwise has no access to the files. When you add something in the pipeline tool that is not in your project folder, it should ask if the pipeline needs to copy the content to the folder. Does that happen in your case? – Felsir Jan 2 '16 at 14:15
• The Pipeline asks me if it should, and does, copy to the project folder. But it do not show up in the project explorer until I add it in visual studio. It works if I add things in both places. – Lord Wolfenstein Jan 2 '16 at 19:13