Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

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 USMember ✭✭✭✭✭
    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.

  • VladimirMischenchukVladimirMischenchuk USMember
    edited June 8

    I've slightly modified approach of @SaschaMllner and I didn't have a chance to test all cases, but this still might be useful for fans of modularity like me :) Cannot post any links yet, please copy from markdown

Sign In or Register to comment.