Forum Cross Platform with Xamarin

How to handle shared files across multiple apps and platforms

So we're building a bunch of apps that all share a common base functionality and implement specific workflows on top of that. These apps should all share the same icons, images, etc.

Up until now we just copied all the files for all apps into the specific folders (/Resources/drawable for Android, /Resources for iOS, / for UWP). This quickly gets out of hand if you add a new functionality with a new icon as we now have to remember to copy the new file to all apps/platforms.

So we created a shared folder with all the images and include the files from there as links. For UWP, this works quite easily, as we can just go into the .csproj file and write <Content Include="..\..\..\images\**" /> to grab all images from there.

I don't know how to do the same with Android and iOS as the files have to be linked into a specific folder. I can of course add an entry for each file:

<AndroidResource Include="..\..\..\images\abort.png">

But this way I would still have to go to each app after adding an image and add this entry. Is there any way to include a whole directory and link it to a specific location inside my project?

Or is there a more elegant way of handling stuff like this?

Best Answer


  • ArneLehmannArneLehmann DEMember ✭✭

    Why not? Because I didn't know about them ;)

    This does seem like quite a bit of work to convert our existing projects to this way of image loading, but it appears to solve some of our problems. Thanks for that!

Sign In or Register to comment.