通用 Windows 平台中找不到文件异常
File Not Found Exception in Universal Windows Platform
请帮帮我,我在 C# 中的一些异步方法中有以下代码行,我使用通用 Windows 平台(Windows 10 SDK 10.0.14393):
var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/HamburgerMenuItems.json"));
问题是这个异常:System.IO.FileNotFoundException 发生在 mscorlib.ni.dll。
Visual Studio 告诉我,该文件在 Assets 文件夹中并且文件没问题,因为它可以正常打开(它是非常短的 json 文件)。可能是什么问题或者这个问题的解决方案是什么?
将 BuildAction
更改为 Content
,将 Copy to Output Directory
从 Do not copy
更改为 Awayls
。
请帮帮我,我在 C# 中的一些异步方法中有以下代码行,我使用通用 Windows 平台(Windows 10 SDK 10.0.14393):
var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/HamburgerMenuItems.json"));
问题是这个异常:System.IO.FileNotFoundException 发生在 mscorlib.ni.dll。
Visual Studio 告诉我,该文件在 Assets 文件夹中并且文件没问题,因为它可以正常打开(它是非常短的 json 文件)。可能是什么问题或者这个问题的解决方案是什么?
将 BuildAction
更改为 Content
,将 Copy to Output Directory
从 Do not copy
更改为 Awayls
。