Question

I'm just about ready to submit my very first game to the marketplace but i ran into this problem.

I realized today that my XAP file seemed reallly small. (350kb roughly) I was reading today that all my content (textures, sounds, fonts) should have their build actions set to "content" rather than "compile" which they were previously set to. I set them all to the "content" setting and now I'm getting "Error loading "filename". File not found."

I didn't change ANYTHING else but the build action and I've confirmed that all the files are not found. Is there something i need to change in my load statements after changing the build action? Currently my load statements look like these.

font = content.Load<SpriteFont>("menufont");

or

ShipTexture = ScreenManager.Game.Content.Load<Texture2D>("Jet");

fyi I've built my game from the ground up using the GameStateManagement sample, in case that matters.

Please help. Thanks.

Was it helpful?

Solution

I'm not sure where you read that, but it's not true.

The ContentManager object, like Game.Content, is programmed to look for xnb files. Those have to be compiled from source files, like .png's, .wav's, etc. Setting to Content copies the source files over directly into the XAP, and you must thus open it with TitleContainer.OpenStream to use it, instead of the normal Content.Load, because it will not be an xnb file.

If your XAP file is curiously small, it is probably because XAPs use ZIP compression on the entire package. Check out your "Content" folder in your bin\Debug or bin\Release folder to see the full size, uncompressed.

OTHER TIPS

You want it set to Compile, not Content. Build Action: Compile means that it will be processed as XNA content into an .xnb file which is then accessible from a ContentManager.Load<T> call. Build Action: Content is something else which does not result in your content being compiled. It's either just copied straight over, or ignored, but either way the asset won't be available from the ContentManager.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top