Class Library asset catalogs overriding app asset catalogs

JoeMankeJoeManke USMember ✭✭✭✭✭

This is for a Xamarin.Forms project, but an iOS specific problem so I thought maybe this was a more appropriate place.

I have two Xamarin.Forms apps, which are to share some pages and functionality. For the actual functionality, I have the first app's Forms project referencing the second app's Forms project. For image resources used by the second app's pages, I have created an iOS Class Library, referenced by both apps' iOS projects. The library contains both BundleResource images, and asset catalogs. However, when I build the first app, its asset catalog resources are missing, while the second app's are present. The non-asset-catalog, BundleResource images for the first app are still present.

Anyone have any tips for resolving this?

Best Answers

  • JoeMankeJoeManke US ✭✭✭✭✭
    Accepted Answer

    I ended up just not using asset catalogs for the shared resources.


  • tokotoko USMember ✭✭

    Did you find a different solution to this?

    We are facing probably the same issue:

  • JoeMankeJoeManke USMember ✭✭✭✭✭
    Accepted Answer

    I ended up just not using asset catalogs for the shared resources.

  • SaschaMllnerSaschaMllner USMember
    edited November 2017

    To fix this issue on our highly modularised project we are using a shell script to gather all assets and patch all existing files in the App. project:

    Consider this workaround quality!

    Just add it to your After Build stage in the Custom Commands

    ${SolutionDir}/Tools/ -s ${SolutionDir}/src/ -o ${ProjectDir}

  • wjm110wjm110 Member
    edited May 2018

    @SaschaMllner The script appeared to run successfully, but it did not solve the problem.

    var image = UIImage.FromBundle("Image");

    still returns null.

Sign In or Register to comment.