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

Load an asset inside an MSBuild thread

Last post 11/19/2009 7:13 PM by Shawn Hargreaves. 1 replies.
  • 11/19/2009 5:27 PM

    Load an asset inside an MSBuild thread

    The question is really simple, but don't have found anything on internet or inside this forum.

    I can load a compiled assed (.xnb) inside a content pipeline project or inside a .dll to use onto an MSBuild instance?

    I've builded a world editor and I use MSBuild to build contents bypassing Visual Studio.
    Inside a .dll I have all processors and importers and work really well but now I need to load a compiled asset at compile-time.

    The necessity to load compiled asset is for this reason:
     - I compile first small assets that are detail meshes 
     - next i compile the main world and I need to load the compiled detail meshes to calculate illumination and other things to save per instance of a detail mesh inside the world asset file.

    I hope to be clear...and all your help guys are wellcome!
    Tanks in advance. 
    Marco
  • 11/19/2009 7:13 PM In reply to

    Re: Load an asset inside an MSBuild thread

    You can load an .xnb at any point through the ContentManager, by calling ContentManager.Load in the usual way.

    However, doing this will cause problems if you are cross-compiling (building content for any platform other than Windows). For instance if you are building for Xbox, you will have produced Xbox format output .xnb files, which you can not load back into your Windows processor code.

    If you care about platforms other than Windows, I would refactor this code to extract the info you need from your design time types (Object B in this diagram) rather than the final outputs. ContentProcessorContext.BuildAndLoadAsset would be the perfect way to access this data.
    XNA Framework Developer - blog - homepage
Page 1 of 1 (2 items) Previous Next