0

I'm working on a game project right now where each level of the game is represented by a text file showing the physical layout (similar to the xna platformer example) with a corresponding xml file containg the rest of the information about the level. Each text file and xml file are put in their own folder which is named after the ID of the level.

Unfortunately this means I need to manually create each folder, then import the two files, then for both files set the build action to "none" and Copy to Output directory to "copy if newer".

Is there a way to automate this for a large amount of files/folders? Or should I just try a different system?

  • 1
    Just send all your files together straight to the Content folder of your build and change the loading script so your files can have the ID in their names. Will there be any issues besides that? – user1306322 Dec 21 '12 at 12:33
  • Or you could create a console application, or execute a batch script, that would copy all your level files to the build folder before the project is compiled. Visual Studio has this handy option to execute scripts (running external applications included) on build. – user1306322 Dec 21 '12 at 12:36
  • Thanks for your reply. With the first option will I be able to set all of the build properties at once or will I have to do each file individually? – Brendan Curran Dec 21 '12 at 15:20
  • Why do you need those build properties? To copy files from source folder to build folder? Why not put them in the build folder from the beginning then? That way you simply won't even need to do anything with build properties. That is in case you have a custom content pipeline. – user1306322 Dec 21 '12 at 19:11

1 Answers1

0

If you're amenable to the idea of giving your files custom extensions, you could always create custom content importers for them. Visual Studio will automatically associate files of the appropriate type with their associated custom importer and processor when you add them to your content project.

This article on MSDN provides details on how to write custom content importers and processors.

Cole Campbell
  • 4,846
  • 1
  • 17
  • 20