1

I'm switching a game from to and hit a snag.

I've got my .spritefont file in project_name/Content, it's listed in the solution explorer, and I'm loading it with this line:

debug_font = Content.Load<SpriteFont> ("Kooten");

But I'm getting the error:

"Microsoft.Xna.Framework.Content.ContentLoadException occurred in Monogame.Framework.dll. Could not load Kooten asset as a non-content file!"

What am I missing?

Nightmare Games
  • 2,205
  • 6
  • 28
  • 46

3 Answers3

3

For adding a SpriteFont in , you need to create it in a Content project of an type, compile the game and then copy the generated xnb file over to the project (the file can be located in the output directory path). Then change its properties so that it is set as "Content" and copied to the output folder if newer.

enter image description here

You can find the full explanation on this blog.

Nahuel Ianni
  • 3,177
  • 4
  • 23
  • 30
0

Under solution explorer, click and highlight the file. In the file properties make sure the "Build Action" drop-down has "Content" selected.

Dan Teesdale
  • 1,823
  • 15
  • 26
  • I don't see a field "Type" but I do see "Build Action". I set this to "Content", but it did not change the result. – Nightmare Games Nov 06 '14 at 23:10
  • @NightmareGames Sorry, did not have Visual Studio handy when I replied. Fixed. Like the other answer suggests, also make sure it is an .xnb file. – Dan Teesdale Nov 07 '14 at 13:55
0

Don't forget to Rebuild solution after making these changes...!