I have a .NET MAUI app in which I'm trying to create a network service area analysis task using a local geodatabase's network dataset. See here for docs. The geodatabase exists directly in the code directory inside a Data assets folder (Project/Data/FT_Data.gdb).
My eventual goal is to use an MMPK that I download from a non-Portal, non-AGOL network server that contains the network dataset in question. But for now, I'm starting off trying to feed the local gdb in. This is where I'm running into issues.
See code below:
string dbLocation = System.IO.Path.Combine(Environment.CurrentDirectory, @"Data", @"FT_data.gdb");
ServiceAreaTask serviceAreaTask = await ServiceAreaTask.CreateAsync(dbLocation, "network");
The application crashes at Line 1 here, because it cannot find the geodatabase at this location. I know this logic generally works at finding other files, since I've tried the same line with an MMPK that exists, and it can find it no problem.
The issue results from not being able to set the build action for a geodatabase in Visual Studio's Solution Explorer pane. With an MMPK or other files, I can set the Build action to "Content" and it will work. But for a geodatabase that exists as a directory in Solution Explorer, I don't want to go in and set the build action for each of the binary files.
So, there you have it. How can I reference a local geodatabase that already exists? I'm trying to do a pretty simple task that the .NET Maps SDK tells me I should be able to. But the only examples I could find are gdb downloaded from ArcGIS Enterprise Portal or Online and then stored in a folder outside the code.
Thank you!