aca
aca

Reputation: 48

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

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);

Upvotes: 3

Views: 1212

Answers (2)

anderZubi
anderZubi

Reputation: 6424

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

enter image description here

Upvotes: 4

y2bd
y2bd

Reputation: 6456

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

Upvotes: 0

Related Questions