在通用Windows平台中找不到文件异常 [英] File Not Found Exception in Universal Windows Platform
问题描述
请帮帮我,我在异步方法中的C#中包含以下代码行,并且使用通用Windows平台(Windows 10 SDK 10.0.14393):
var file =等待StorageFile.GetFileFromApplicationUriAsync(new Uri( ms-appx:///Assets/HamburgerMenuItems.json));;
问题是此异常:mscorlib.ni.dll中发生了System.IO.FileNotFoundException。
Visual Studio告诉我,该文件位于Assets文件夹内,并且该文件正常,因为它可以正常打开(这是非常短的json文件)。
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
Change the BuildAction
to Content
and Copy to Output Directory
from Do not copy
to Awayls
.
这篇关于在通用Windows平台中找不到文件异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!