0

I have a Silverlght library project that produces a dll output. This project utilises a xml file for parsing etc.
There is a second project that references the Dll project to get the built dll files and package into a xap.
However, when I run my silverlight web application project, it gives me an error that there is no xyz.xml file found
What properties of the .xml file do I need to change so tha it goes with the dll in the xap file?

EDIT

Setting the Build action to Embedded Resource gives the timing.xml as a separate file in the bin/Debug folder when looked in Windows Explorer.
Setting the Build action to Resource does not give timing.xml as a separate file in the bin.Debug folder, but only a single dll. I don't know if it gets packaged with the .dll file in this way but it is still not in the .xap file that is prepared after that.

The project that produces dll is referenced by another project that produces xap.

user1240679
  • 6,829
  • 17
  • 60
  • 89
  • Try setting an xml as Embedded Resource and getting it using Assembly.GetManifestResourceStream. – Dmitry Reznik Apr 05 '12 at 06:00
  • I tried setting the xml to Embedded resource, but I am not able to understant what you mean by `getting it`? Where would we have to get it? :-/ – user1240679 Apr 05 '12 at 06:43
  • When you embed a resource, it goes in the dll. There won't be xml file near the .dll file, it will be in it. To get contents of that file you need to use Assembly.GetManifestResourceStream. See this so post for reference: http://stackoverflow.com/questions/2820384/reading-embedded-xml-file-c-sharp – Dmitry Reznik Apr 05 '12 at 19:30

1 Answers1

0

If you set build action of the .xml file to Content, the file will be included in the application package without embedding it in the project assembly. Resource build action will embed the file in the project assembly.

Resource Files.

Zabavsky
  • 13,340
  • 8
  • 54
  • 79
  • Setting the Build action to Embedded Resource gives the timing.xml as a separate file in the bin/Debug folder when look in Windows Explorer Setting the Build action to Resource does not give timing.xml as a separate file in the bin.Debug folder. I don't know if it gets packaged with the .dll file in this way But, it is still not in the .xap file that is prepared afetr that. – user1240679 Apr 05 '12 at 06:50
  • To copy to .xap set to `Content`, `Copy to Output Directory` - `Copy if newer` or `Copy always`. – Zabavsky Apr 05 '12 at 07:27
  • Please see my EDIT in the post – user1240679 Apr 05 '12 at 07:30