How can I get a file into an app bundle and read it, in .NET MAUI?
MPR
1
Reputation point
I have a .mmpk file (used by ESRI for ArcGIS). In a .NET MAUI project in Visual Studio for the Mac, I dragged the file into the Resources/Raw directory. Its properties are Build Action: MauiAsset and Copy to output directory: Always copy.
When I try and read it I get this error:
ArcGIS Maps SDK: Load Error: MobileMapPackage
System.IO.FileNotFoundException
File not found: /data/user/0/com.companyname.displayamap/files/MahouRivieraTrails.mmpk
I am trying to read it using this code:
string pathToMobileMapPackage = System.IO.Path.Combine(/*Environment.CurrentDirectory*/FileSystem.Current.A, @"MahouRivieraTrails.mmpk") ;
MobileMapPackage mahouRivieraTrails_MobileMapPackage = new MobileMapPackage(pathToMobileMapPackage);
await mahouRivieraTrails_MobileMapPackage.LoadAsync();
this.Map = mahouRivieraTrails_MobileMapPackage.Maps.FirstOrDefault();
I've tried several approaches, as you can see.
Why isn't this working?
Any help would be hugely appreciated, as I am trying to avoid having to just give up and switch to Swift.
Developer technologies .NET .NET MAUI
4,152 questions
Sign in to answer