These articles tell you to create the
Content.mgcb file if it doesn't exist already. They assume that it doesn't exist, for convenience (for example, if you're using the NuGet installation of MonoGame.)
If it already exists, use the existing
Content.mgcb. It's already set up to build when you compile/run your game.
- Right-click the Content.mgcb file in Solution Explorer
- Click "Open With"
- A box should come up asking you what to open it with - choose "MonoGame Pipeline Tool".
This will pop open the MG pipeline tool GUI. Right-click in the treeview to the left, click "Add > New Folder". Name it "graphics" or whatever you desire.
It'll add to the tree. Right-click the new folder, click "Add > Existing Item". Find the PNG texture you'd like to add and open it. Then, click "File > Save" in the Content Pipeline.
Then, in Visual Studio, in your game class, add a
Texture2D variable to store the texture in. In
myTextureVariable = Content.Load<Texture2D>("graphics/myTexture");
Note: Replace "graphics/myTexture" with the asset path to the PNG image you added in Content Pipeline. If you added a PNG file named "smile" to the "graphics" folder, the asset path is "graphics/smile".
You must also omit the file extension of the PNG file in the asset path - so, it's "smile", not "smile.png".
Then, for good practice, in UnloadContent:
myTexture = null;
to free up the RAM taken by your loaded texture.
Hopefully that helps!