开发者

How to Include an xml file from a silverlight class library into the xap file

I have a certain config.xml file in one of my projects (Silverlight class library) i开发者_开发技巧n a folder in the solution. It's build action is set to content. In that same project I am trying to load the xml file by saying:

XDocument xml = XDocument.Load("/config.xml");

This unfortunately is not working. Upon inspecting the xap file, I see that the xml file is not being copied to it. I am using Visual Studio 2010 RC.


You need to include the file marked 'Content' in the main application's project to get it to show up in the .Xap. If you control the main app, you could link in the .xml file and mark it as Content.

If you can't do that, mark the .xml file as an Embedded Resource, it's less flexible and will be built into the .dll, but that is your only other option.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜