Don't know how to refer to a file in my project using ms-appx (wp8)

烂漫一生 提交于 2019-12-22 09:49:51

问题


I want to refer to a grammar file in my project(Rootfile->folder named grammar->the file named NumbersGrammar) I used this line of code but it tells me the 0x80070002 error (the system cannot find the file specified):

Uri Numbers = new Uri("ms-appx:///Grammar/NumbersGrammar.grxml" ,UriKind.Absolute);


回答1:


Make sure that the file exists in the specified location, and it's Build Action property is set to Content:




回答2:


Have you tried using appdata instead? In your case the full path would be

new Uri("appdata:/Grammar/NumbersGrammar.grxml");

Apparently although appdata and ms-appx both refer to the installation folder, they must be used for different situations.

Source: http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff402541%28v=vs.105%29.aspx#BKMK_Installationfolder



来源:https://stackoverflow.com/questions/18839454/dont-know-how-to-refer-to-a-file-in-my-project-using-ms-appx-wp8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!