Please suggest me a method to save an XML file to the current installation directory of the application created using C#.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Create an XML file: The easiest way is to create and populate an XmlDocument or XDocument object.
Save to the install directory: use
But you do know that the application’s folder isn’t the best place to store a file, right?
Edit:
Some comments mention Isolated Storage, but that is overkill. The best way to store data is to use the appropriate DataPath. That is different under various versions of Windows, but this always works:
There are a few other values in the
Environment.SpecialFolderenum, take a look.