none
Add an XML file to C# project? RRS feed

  • Question

  • Hi,

    I have an XML file which is used by my program to store certain information. I want to add this to the project so it gets installed to my applications directory at 'C:\Program Files' when my application is installed.

    How do I do this?

    Thanks.
    Saturday, August 8, 2009 4:45 PM

Answers

  • Project + Add Existing Item, select your .xml file.  In the Properties window, set Build = Content and Copy = if newer.  The "content" setting ensures your Setup and Deployment project automatically adds the file.  The "copy" setting ensures the file is present in your bin\Debug folder.  You could also consider adding it as a resource if editing is never required.

    Hans Passant.
    • Marked as answer by Jimmy Collins Sunday, August 9, 2009 6:24 PM
    Saturday, August 8, 2009 5:39 PM
    Moderator

All replies

  • Project + Add Existing Item, select your .xml file.  In the Properties window, set Build = Content and Copy = if newer.  The "content" setting ensures your Setup and Deployment project automatically adds the file.  The "copy" setting ensures the file is present in your bin\Debug folder.  You could also consider adding it as a resource if editing is never required.

    Hans Passant.
    • Marked as answer by Jimmy Collins Sunday, August 9, 2009 6:24 PM
    Saturday, August 8, 2009 5:39 PM
    Moderator
  • Hi,
    Thanks nobugz
    We are volunteers, if the reply help you mark it as your answer. thanks!!
    My Blog
    Saturday, August 8, 2009 9:26 PM