Reputation: 25460
Can the .xnb resource files generated by the XNA content pipeline be embedded into the application (exe) or a library (dll), instead of being dumped into the 'content' folder as loose files?
If so can this process be automated as part of the regular build process?
Upvotes: 2
Views: 1402
Reputation: 27215
Yes, you can do this. In fact there's functionality for doing this (ResourceContentManager
) built into the framework.
This blog post describes how to do it.
(It's important to note that, by embedding resources into the assembly - they will all get loaded into memory in one hit, when your assembly is loaded! Also it does not work for some resource types that must stream from disk.)
Automating it is trickier. The method described in that blog post requires you to build the content once, and then add the output XNB file to the project. A this point it should "just work" - although the different XNB outputs for Debug vs Release could be problematic.
If you want to remove this step, then you will need to mess about with MSBuild a bit. I think you might have some luck if you attempt to combine the information in this question (explaining how to do wildcards in MSBuild) and possibly this question (how to do folders, and the two available kinds of embedding).
Upvotes: 2