xap中找不到xml文件 [英] Xml file not found in xap
问题描述
我向我的项目添加了一个文件夹,并向该文件夹添加了 xml 文件。
将文件的构建操作设置为资源。现在尝试使用下面给出的行加载文件
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);
XDocument xDoc = XDocument.Load("Xml/MyXML.xml");
项目编译成功,但在运行时我得到以下异常:
The project compiles successfully but while running I get the below exception:
在应用程序xap包中找不到文件'WORDXML.xml'
Cannot find file 'WORDXML.xml' in the application xap package.
此外,我检查了所创建的XAP,但未找到与文件夹相关的任何内容。
Also, i checked the created XAP and not find anything related to folder.
推荐答案
您需要将构建操作设置为 Content
。或者您需要将其作为资源加载, Application.GetResourceStream
You need to set the build action to Content
. Or otherwise you need to load it as a resource, with Application.GetResourceStream
这篇关于xap中找不到xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!