I'm trying to read a json
file from my Assets folder. I've tried numerous code examples, and all are variations on the same thing.
I feel like I must be doing something stupid, but I just can't see it.
string filepath = @"Assets\resources.json";
StorageFolder folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFile file = await folder.GetFileAsync(filepath); // error here
var data = await Windows.Storage.FileIO.ReadTextAsync(file);
Every time I run the above code I get a System.IO.FileNotFoundException
on my app. I've double and tripled checked the file is in the assets folder and there are no typos in my path.
I've also tried this
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/resources.json"));
Same error. System.IO.FileNotFoundException
Screenshot of my Assets folder: