Technocrat
Technocrat

Reputation: 334

XNA/MonoGame publishing game, could not load SpriteFont as non content file

I have finished making a game; however, when I try to publish it. It publishes fine but when launching the application it crashes SpriteFontenter image description here

It says that it could not find MyFont.xnb (which is a SpriteFont in the content folder)

When I go to my Program Files and look, the SpriteFont is nowhere in my solution. Why did it not build with the rest of the program?

In my application itself, I made sure to include the asset and it works fine if I run the program on my machine. It only crashes like this after I publish the application.

Proof

How do I fix this issue?

Upvotes: 0

Views: 555

Answers (2)

Technocrat
Technocrat

Reputation: 334

Okay so I fixed my issue:

I made my XNB file Build Action set to: "Content" and "Copy always"

Then, when setting up the project to release I used InstallShield Limited Edition Deploy.

When asking me for which files to deploy, I made sure to select "Primary Output" "Content" and "Add File" -> "MyFont.xnb" and I added it in manually, that made sure it was ready to go.

Upvotes: 0

Mark Randle
Mark Randle

Reputation: 55

Try checking the properties for the file in whatever compiler you're using.

In visual studio for example :

Make sure Build Action is set to compile.

Make sure copy to output directory is set to anything but do not copy, which is the default for monogame in my experience.

Upvotes: 1

Related Questions