Xml file not found in xap

☆樱花仙子☆ 提交于 2019-12-25 06:13:15

问题


I added a folder to my project and I added an xml file to the folder. Set Build Action of file as Resource. Now try to load the file using line given below

XDocument xDoc = XDocument.Load("Xml/MyXML.xml");

The project compiles successfully but while running I get the below exception:

Cannot find file 'WORDXML.xml' in the application xap package.

Also, i checked the created XAP and not find anything related to folder.

Could anybody help me out where I am missing


回答1:


You need to set the build action to Content. Or otherwise you need to load it as a resource, with Application.GetResourceStream



来源:https://stackoverflow.com/questions/8091818/xml-file-not-found-in-xap

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