Let's say I have an xml file which looks like this


Would it be possible to use a custom importer/writer/reader to create two files, Pistol.xnb and MachineGun.xnb which I can load individually with Content.Load()?

While writing this I realized I could just import a Weapon[] list and split them up with a helper, but I'm still wondering if this is possible?


2 Answers 2


Basically: No.

The content pipeline transforms a single input file into a single output file. It can also do a single input file plus dependencies, into a single output file. And you can also trigger building of other files into assets.

But it cannot generate multiple outputs from a single file.

This thread on the App Hub forums explains it in more detail. (And may have some ideas for work-arounds.)

  • \$\begingroup\$ link has decayed \$\endgroup\$
    – Andrey
    Commented Sep 4, 2012 at 3:37

Yes, you can.

With the dependency system, you can call


to make the Content Pipeline build whichever asset you want, and get the external reference to that file. Keep in mind that this isn't very flexible, and all the assets built this way will have the name of the original asset plus "_0", "_1", etc. to mark them as dependent from the original.

Also, ContentProcessorContext is an abstract class and you can inherit from it and extend with the functionality you want. So, when you are compiling your specific asset, create a new instance of your custom processor context and let it do its own magic.

Keep in mind that this requires a very advanced knowledge of the XNA pipeline and will be too much effort if you are a beginner.

  • \$\begingroup\$ Even though this technically is a more correct answer, Andrew's was still more the answer I was looking for. \$\endgroup\$
    – Zeta Two
    Commented Mar 28, 2011 at 16:35
  • 5
    \$\begingroup\$ Then if you are expecting a "no", I don't see the point in asking :) \$\endgroup\$
    – r2d2rigo
    Commented Mar 28, 2011 at 18:05
  • \$\begingroup\$ If you call the second overload of BuildAsset() you will even be able to specify the name of the output asset. \$\endgroup\$
    – cubrman
    Commented Mar 29, 2015 at 20:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .