Recursive BundleResource Links

CWaterCWater USMember ✭✭
edited October 2016 in Xamarin.iOS

Hello, this is my first post on this forum so please forgive me if this is in the wrong place or improperly formatted.
I have recently been working to add some external bundle resources to my iOS application, however, when Xamarin adds the resources to the .csproj file they are added individually, rather than loading them recursively from the given directory. I have had success in making manual edits to the .csproj file to recursively load these resources, but since I am using a link to these externally loaded resources rather than having the resources copied to the resource folder itself(they need to be shared across several projects), the file names are not being resolved properly. Please see the following code snippet for more information.

<BundleResource Include="..\AppResources\**\*.*"> <Link>Resources\AppResources\**\*.*</Link> </BundleResource>

The <BundleResource> tag is correctly getting all the files within the "AppResources" folder, however, the <Link> tag is not maintaining the correct directory structure, will only load one sub-directory named **, and all files within said sub-directory will be named *.*. The intended outcome is that the directory structure is maintained and all sub-directories and files within these sub-directories will be coincide with the correct file name.
Any advice as to how I may resolve this issue would be greatly appreciated!

Posts

  • CWaterCWater USMember ✭✭

    My apologies for the double post, but I figured I would give an update for anyone that is interested or may be able to help. I have made some progress on this issue, but am still not able to produce what I am looking for. This is what I have now:

    <BundleResource Include="..\AppResources\**\*.*"> <Link>Resources\AppResources\%(RecursiveDir)%(Filename)%(Extension)</Link> </BundleResource>

    This does recursively link to all files within the AppResources directory while maintaining the correct directory structure and file names. My question now is, how do I exclude certain sub-directories within the AppResources folder.
    For instance, lets say I have the directory structure "AppResources\Folder1" and inside "Folder1" there are two additional sub-directories "AppResources\Folder1\Foo" and "AppResources\Folder1\Bar". I want to include a link to the "Foo" directory, but would like to exclude the "Bar" directory... how would I go about doing this?

    Thanks in advance!

  • rraallvvrraallvv Member ✭✭
    edited February 2018

    @CWater did you find a solution? I had to add one BundleResource entry for each subdirectory, because using ** is adding a Resources folder within the Resources with the same contents, over and over, something like below:

    +-Project
      +-Resources
        |-image.png
        +-Resources
          |-image.png
          +-Resources
            |-image.png
            +-Resources
              |...
    
Sign In or Register to comment.