Accessing Shared Resource Files

DaveCarsonDaveCarson GBUniversity ✭✭✭

I'm currently working on an iOS app which will be using json files to manage some simple data requirements (SQLite was a bit overkill for this). Because the intention is to also create an Android version of the application, using the same files, I've added them to a PCL and linked them to the iOS project - but they do not appear in the build output.

Initially I had them in a separate folder, i.e. /configuration, but then moved them into the Resources folder but still they don't appear in the generated output. I've tried putting them in a sub folder (within Resources) and as many permutations of Build Action as I thought appropriate but still no joy.

I'm using Xamarin Studio on a Mac and linking the files in the normal way.

What am I missing here?

Best Answer

Answers

  • adamkempadamkemp USInsider, Developer Group Leader mod

    The other option is to include it as an AndroidResource in your Android project and a BundleResource in your iOS project (but use a linked file so that it's the same physical file).

  • DaveCarsonDaveCarson GBUniversity ✭✭✭

    I found a decent sample - https://developer.xamarin.com/samples/mobile/EmbeddedResources/ which achieved what I want to do .... sort of.

    I'll use some constants to enable me to specify which resource/configuration file to fetch and just leave the files themselves in the PCL instead of linking them over.

    Thanks @adamkemp for the input (didn't think I was going mad)

Sign In or Register to comment.