locked
How to add external resource folder to a c++ project so that it can be deployed in app package?

    Question

  • Hi,

    I try to transplant my app to Windows platform, now I meet a problem that:

    my app's all resources(images/sounds etc.) are put in a single folder named 'Resources'. I think the folder can directly copied to Metro app project's folder. And I do so. But I find that when deploy or package the app, the 'Resources' folder is not be included.

    Then, I think I should add the 'Resources' folder to my Metro app's project. My app's project is written in c++, the folder in project is named 'filter', not real folder. I tried 'ctrl+c' and 'ctrl+v' to copy the folder to project, it did not work.

    I do not want to add those resources files to my project one by one, the number of files is so much and the sub-folder is so deep. 

    Sunday, May 25, 2014 3:27 PM

Answers

  • Hi Lattimore,

    I believe this could be a Visual Studio issue, I cannot directly paste the folder to C++ project neither. Probably you can raise a suggestion on connect site(https://connect.microsoft.com/VisualStudio) for helping us improving the VS user experience.

    However, I would suggest you to achieve this by following steps:

    1, Unload the project, and right click the project choose edit the .vcxproj file.

    2, Copy your resource folder to the app project folder, I assume the name of the folder is 'Resources'.

    3, Edit the vcxproj file, the bold line is the place you have to add.

      <ItemGroup>
        <Image Include="Assets\Logo.scale-100.png" />
        <Image Include="Assets\SmallLogo.scale-100.png" />
        <Image Include="Assets\StoreLogo.scale-100.png" />
        <Image Include="Assets\SplashScreen.scale-100.png" />
        <Image Include="Resource\*\*.*" />
      </ItemGroup>

    4, Reload the app and you should be able to see your Resource Folder has been successfully included into the project. You have to click the button as I mark in the figure below to view all the folders.

    See this How to: Select the Files to Build for more information.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Wednesday, May 28, 2014 3:21 AM
    Moderator

All replies

  • Hi,

    C++ project system uses filters to creater virtual solution folder. You can try adding a new filter by right click on project - > Add -> New Filter.

    If you still want to create folders, you can click on "Show All Files" in the Solution Folder and then add new folder using right click on project -> Add -> New Folder.

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, May 26, 2014 2:39 AM
  • Hi,

    I know what's 'filter' meaning in cpp project. I want VS can copy an external folder to my app's package when building it, without add all files under the external folder into my project. I do not know how to config it in VS 2013. 


    • Edited by Lattimore Tuesday, May 27, 2014 2:27 PM
    Tuesday, May 27, 2014 2:26 PM
  • Hi Lattimore,

    I believe this could be a Visual Studio issue, I cannot directly paste the folder to C++ project neither. Probably you can raise a suggestion on connect site(https://connect.microsoft.com/VisualStudio) for helping us improving the VS user experience.

    However, I would suggest you to achieve this by following steps:

    1, Unload the project, and right click the project choose edit the .vcxproj file.

    2, Copy your resource folder to the app project folder, I assume the name of the folder is 'Resources'.

    3, Edit the vcxproj file, the bold line is the place you have to add.

      <ItemGroup>
        <Image Include="Assets\Logo.scale-100.png" />
        <Image Include="Assets\SmallLogo.scale-100.png" />
        <Image Include="Assets\StoreLogo.scale-100.png" />
        <Image Include="Assets\SplashScreen.scale-100.png" />
        <Image Include="Resource\*\*.*" />
      </ItemGroup>

    4, Reload the app and you should be able to see your Resource Folder has been successfully included into the project. You have to click the button as I mark in the figure below to view all the folders.

    See this How to: Select the Files to Build for more information.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Wednesday, May 28, 2014 3:21 AM
    Moderator
  • Hi Jamles,

    Thanks for your answer, it works here. 

    Wednesday, May 28, 2014 7:08 AM