Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File Not Found Exception in Universal Windows Platform

Plase, help me, I have the following line of code in C# inside some async method and I use Universal Windows Platform (Windows 10 SDK 10.0.14393):

var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/HamburgerMenuItems.json"));

The problem is this exception: System.IO.FileNotFoundException occurred in mscorlib.ni.dll.

Visual Studio shows me, that the file is inside the Assets folder and the file is ok, because it opens normally (it is very short json file). What can be the problem or what is solution for this problem?

this image shows, that the file is inside the Assets folder

like image 211
Peter Avatar asked Mar 12 '23 12:03

Peter


1 Answers

Change the BuildAction to Content and Copy to Output Directory from Do not copy to Awayls.

enter image description here

like image 114
Andrii Krupka Avatar answered Mar 20 '23 22:03

Andrii Krupka