locked
How to depoly the resource into the AppX directory while keeping the directoy structure

    Question

  • I am now trying to make a metro-style game. And I have a lot of resources grouped in different sub directories. I want to know how to deploy them into the AppX directory. I tried to add the resources into the "Assets" filter. But it cannot keep the directory structure.
    Friday, August 17, 2012 8:21 AM

Answers

  • "Assets" is not a physical folder on the machine. It is just a filter in the solution explorer. If you would like to have "Assets/font" directory after the packaging/deployment, you may create Assets/font folder on the disk and include that in the project. Font files (with extension as .ttf, .otf, .compositfont) will be include as content for win8 app by default.

    Just as an FYI. The following file types and extensions are treated by default as content for win8 app.

    • text  (.txt, *.log),
    • image (.jpg, .jpeg, .jpe, jfif, .png, .bmp, .dib, .gif, .ico, .tif, .tiff, .dds)
    • media (.mp3, .wav, .mov, .mp4, .wmv, .webm)
    • XML (.xml, xslt, .xsl),
    • XSD (.xsd),
    • font (.ttf, .otf, .compositfont)

    Li Shao (MSFT)


    Li Shao

    • Proposed as answer by Jesse Jiang Thursday, August 30, 2012 6:05 AM
    • Marked as answer by Jesse Jiang Wednesday, September 05, 2012 7:11 AM
    Monday, August 27, 2012 9:31 PM

All replies

  • Hi,

    You can check the Relative Path in the item properties.

    For example, you can click item.png, in the Properties windows, we can see there is a relative Path, we can check if it is Asserts\item.png.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Monday, August 20, 2012 8:34 AM
  • Thanks for your reply. The relative path property seems only work if we put the data into the 'Asserts' directory under the project directory. Otherwise we can't keep the directory structure.

    Since we are developing a multi-platform game and we don't want to put the data into the project directory. Is there any way to copy the data into the 'Assets' directory under the AppX directory automatically during the deploy phase?

    Monday, August 20, 2012 9:25 AM
  • You can make the resources as "Content" by change the "Content" property to "true" for the intended files in the property grid windows (The window shows under "solution explorer" in a default layout).

    Li Shao, MSFT


    Li Shao

    Thursday, August 23, 2012 2:52 AM
  • Sorry, maybe I missed something. I have already marked a resource as "Content" but it just copy the file into the "Assets" directory directly.

    In my project, I have a directory called "font" and it contains a font file. After deploying, I only can find the font file under the "Assets" directory instead of the "Assets/font" directory.

    Friday, August 24, 2012 8:59 AM
  • "Assets" is not a physical folder on the machine. It is just a filter in the solution explorer. If you would like to have "Assets/font" directory after the packaging/deployment, you may create Assets/font folder on the disk and include that in the project. Font files (with extension as .ttf, .otf, .compositfont) will be include as content for win8 app by default.

    Just as an FYI. The following file types and extensions are treated by default as content for win8 app.

    • text  (.txt, *.log),
    • image (.jpg, .jpeg, .jpe, jfif, .png, .bmp, .dib, .gif, .ico, .tif, .tiff, .dds)
    • media (.mp3, .wav, .mov, .mp4, .wmv, .webm)
    • XML (.xml, xslt, .xsl),
    • XSD (.xsd),
    • font (.ttf, .otf, .compositfont)

    Li Shao (MSFT)


    Li Shao

    • Proposed as answer by Jesse Jiang Thursday, August 30, 2012 6:05 AM
    • Marked as answer by Jesse Jiang Wednesday, September 05, 2012 7:11 AM
    Monday, August 27, 2012 9:31 PM
  • A half baked answer. The reason why Assets works is because it is in ProjectDir\Assets and the folder is already created when you created the project so the relative path is Assets/image.png.

    Now if you need something like Shaders/MyShader.hlsl just create the Shaders directory in your ProjectDir/ (where the .vcxproj file is), create a filter named the same (Shaders), drag the files there (folder dragging doesn't work, I know, crappy), then when you drag the file there it will have the relative path : Shaders/MyShader.hlsl. Upon deployment it will create the adequate folder in the AppX directory and copy the files there too. Happy coding ;)

    Friday, January 11, 2013 9:39 PM