Search code examples
visual-studiowindows-phone-7xnaxap

Add external files to XAP (deploy extra files to WP7)


using XNA 4.0's TileStorage.OpenStream() you can access files located in the application's binary folder, which are deployed with your application.

You can add files to visual studio project and set them to "copy to output directory", and then these get deployed to the phone, and can be viewed on your PC by looking at your "bin\windows phone\debug" folder

however, if you copy files directly to the "bin\windows phone\debug" folder, these are not deployed to your phone (FYI they get deployed to your Xbox if you are doing xbox development)

How can I deploy additional files to the phone, without adding them to visual studio? Basically I wish to use a postbuild script to get content from a file share, and deploy this + an index file (generated in postbuild) to the phone.

is there any tool, or easy solution for this problem?


Solution

  • A xap file is just a zip file with a different extension. So you can use the post-build event to edit the xap before deployment, using any command-line-aware zip extractor.

    For instance, with 7zip:

    "C:\Program Files (x86)\7-Zip\7z.exe" a -tzip $(ProjectDir)$(OutDir)Test.xap C:\FileToInject.png