XNA Creators Club Online
Page 1 of 1 (7 items)
Sort Posts: Previous Next

Content for the wrong platform

Last post 8/13/2009 7:24 PM by Venatu. 6 replies.
  • 8/13/2009 4:10 PM

    Content for the wrong platform

    Apologies if there is an obvious fix, im only just starting my xbox port

    I have taken my Windows project and used the create a copy for the xbox option. I then used the Device Center to connect to my xbox, and then built the solutions, right clicked the Xbox game, and selected Debug with new instance. There are no deploy errors, but when the game starts, it tells me my content (in this case a spritefont) has been built for the wrong platfrom. What have I done wrong?

    I checked the properties for the content sub-project and it is set to x86. I assume this is because it runs on Windows right, and is not the cause of my grief?

    Thanks,
    Venatu


  • 8/13/2009 4:32 PM In reply to

    Re: Content for the wrong platform

    That's strange, I've never had anything like that happen.

    Venatu:

    I checked the properties for the content sub-project and it is set to x86. I assume this is because it runs on Windows right, and is not the cause of my grief?

    Correct. The content pipeline compiles everything in the Content directory to .xnb format and is then deployed to the Xbox. I just double checked one of my projects and it's set to x86 also, so that is not your problem.

    Have you tried doing a full rebuild of your program?

    Also make sure it's set to Release build and not Debug. You can still start a debug instance on the Xbox when in a release build.

    [edit]: Here, I found half of your problem:
    Venatu:
    im only just starting my xbox port

    You really need to be testing early and often on the Xbox. There are so many things that are different between the Xbox and PC that strange bugs can appear, and it's always best to find them as soon as possible.
    "Software is never finished, it is in varying states of 'less broken'" because "If it ain't broke, it doesn't have enough features yet"

    In Playtest: Avatar Land | The MANLY Game for MANLY Men

    The signature that was too big for the 512 char limit
  • 8/13/2009 4:40 PM In reply to

    Re: Content for the wrong platform

    Yes, ive tried the rebuild, and Ive deleted it from the xbox and redeployed. Ive also set it now to release, but it still fails.

    Here is the exact error text:

    An unhandled exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in Microsoft.Xna.Framework.dll

    Additional information: Error loading "menufont". This file was compiled for the wrong target platform.

    The only thing "non-standard" im doing, is that instead of using a Game Library as the base, im using a Game (i.e. and executable and not a dll). The content of the game is what is failing. Its done this way to allow me to debug my shared game template.
  • 8/13/2009 4:58 PM In reply to

    Re: Content for the wrong platform

    Venatu:
    The only thing "non-standard" im doing, is that instead of using a Game Library as the base, im using a Game (i.e. and executable and not a dll).

    I don't understand what you mean here. As the base for what? You would normally use Game as the base for a game anyway. How is that non-standard? More explanation, please.
  • 8/13/2009 5:09 PM In reply to

    Re: Content for the wrong platform

    Sure, I thought I was expressing it badly

    This is my from my SigmaGameTemplate project:

    public class Game : Microsoft.Xna.Framework.Game

    This is what you were expecting right? Nothing fancy here, and the template can be run as a game. Almost identical to the GameStateManagement sample. Rather than copying this each time I want a new project, I just reference this Project, and in the same solution, create a new Game project and set this as the startup.

    In this new project named InheritedGame: we have this: 

        static class Program 
        { 
            /// <summary> 
            /// The main entry point for the application. 
            /// </summary> 
            static void Main(string[] args) 
            { 
    #if DEBUG 
                using (Game game = new Game(1024, 768)) 
                { 
                    AvalonComponentFactory acf = new AvalonComponentFactory(game); 
                    game.SetComponentFactory(acf); 
                    game.Run(); 
                } 
    #endif 
    #if !DEBUG 
                using (Game game = new Game(1280, 1024)) 
                { 
                    AvalonComponentFactory acf = new AvalonComponentFactory(game); 
                    game.SetComponentFactory(acf); 
                    game.Run(); 
                } 
    #endif 
            } 
        } 

    The component factory creates and passes a new GameplayScreen as needed, which is unique to each game project Im working on. Writing this it seems convoluted, but it works (at least on Windows) and is really simple to implement in each new project. Hope that helps
  • 8/13/2009 5:25 PM In reply to

    Re: Content for the wrong platform

    The only thing I can think of is to check every project (including Content projects) that make up the final game and make sure that each one is set to target the 360. It may be that your Content project is still set as a Windows target...
  • 8/13/2009 7:24 PM In reply to

    Re: Content for the wrong platform

    EDIT: Sorry, how do I check a content project is for the right platform? Nevermind, found it

    I deleted the xbox copy and copied just my template, but it still gives the error.
Page 1 of 1 (7 items) Previous Next