Shared Project approach
Trying to embed database in Shared project. Given in my Shared Project I put database.sqlite3 under Resources folder and ensure build action is Embedded resource:
However, it's not listed with GetManifestResourceNames. Note that DdgRepository
is a class within Shared Project and the code runs within that assembly where Embedded Resource must be present:
And GetManifestResourceStream returns a null Stream.
Project specific: Android Asset approach
Ohwell I still have an option to load database from Android Assets. So I put the database.sqlite3 file within Assets folder and ensure Build action is AndroidAsset:
However it is not listed as Asset and I cannot get then stream. Note that this code runs within Android specific project:
Using:
- Visual Studio 2017 15.4.0
- Xamarin 4.7.10.22
- Xamarin.Android SDK 8.0.0.33
What am I missing? I am nit asking how to do it. I'v read the docs. I don't understand why my assets and resources doesn't get embedded althought I follow the instructions.