在项目中找不到 Json 文件

Can't find Json file inside project

我正在尝试从我的项目中读取 json 文件,但无法找到它。当我使用 .txt 扩展名时,一切正常,但是当我将扩展名更改为 .json 时,找不到文件

string fileContent;
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(@"ms-appx:///Resources/Database/text.json"));
using (StreamReader sRead = new StreamReader(await file.OpenStreamForReadAsync()))
fileContent = await sRead.ReadToEndAsync();

"The system cannot find the file specified. (Exception from HRESULT: 0x80070002)"

为了使用 JSON 文件,您需要在 Visual Studio 的文件资源管理器中右键单击该文件并选择属性,然后在高级部分:

1) 将 Build Action 设置为 Content

2) 将 Copy to Output Directory 设置为 Copy always