using VS 2013, C #
I am trying to use a JSON file in my project. Using the following code (as in the example project from MS):
Uri dataUri = new Uri("ms-appx:///DataModel/MyData.json"); StorageFile fileToRequest = await StorageFile.GetFileFromApplicationUriAsync(dataUri); string jsonText = await FileIO.ReadTextAsync(fileToRequest); JsonObject jsonO = JsonObject.Parse(jsonText); JsonArray jsonA = jsonO["Events"].GetArray();
The result is:

and the next step is the exception file was not found, but it exists


In addition, if the same code is run with a sample project from VS - all this is normal. Code from the sample project:
Uri dataUri = new Uri("ms-appx:///DataModel/SampleData.json"); StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(dataUri); string jsonText = await FileIO.ReadTextAsync(file); JsonObject jsonObject = JsonObject.Parse(jsonText); JsonArray jsonArray = jsonObject["Groups"].GetArray();
Debugging the resulting code:

So the question is: why did I get a FileNotFound exception, why this file is invisible to my project.
gbk
source share