Thursday, April 14, 2011

pack xml files inside dll,c#

I have a .NET C# 2.0 Project and it refers to many .xml files, i'd need these files when i port my project to another location or distribute it. I'm currently not interested in making it as a setup.exe file. I want to to be standalone. currently i've got all of them in a folder "FILES" within my project. So what i want to know is

  1. Can i pack all these XML files inside a dll, so that it's secure and portable? If so how to do it?
  2. When i build the program the FILES folder is not copied. How can i make it copy it as well?
From stackoverflow
  • You can mark the xml files as resources, and they will be packaged inside the assembly. Just set the "build action" to "embedded resource". Alternatively, use a resource file (resx), and drag the xml files onto the resx designer, and it'll do everything for you (including providing access methods to get the data back out).

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.