|
-
September 2nd, 2011, 10:24 AM
#1
C# Application with XML file
Hi, Ive done a simple application on vs2010 which reads and writes to an xml file that i have in my bin folder but when I deploy the application and run it I get an error that it cant find the xml file, does anyone know why this is and how to solve it, cheers
-
September 2nd, 2011, 12:29 PM
#2
Re: C# Application with XML file
Yeah... depending on how you deploy your application, your XML file is not being created for you in the folder your application is deployed to.
Either create/copy the XML file to whatever folder your application runs in, or create an application setting to hold a path to where the file is always located and use that when accessing the file in your application.
Best of luck!
-
September 2nd, 2011, 01:20 PM
#3
Re: C# Application with XML file
If the plan is to have the xml file in the same folder as the application exe, then the solution is pretty simple.
All you need to do is add the xml file to the project (if it isn't already part of the project). Just right click on the project in the solution explorer and choose "Add\Existing item...". Add the xml file.
Next, right click on the xml file in the solution explorer and choose "Properties".
Under "Copy to Output Directory", change the setting to "Copy always".
Now when you build the project, the xml file will automatically get copied to the debug or release folder.
-
September 4th, 2011, 02:23 PM
#4
Re: C# Application with XML file
thanks guys, I ended up writing a bit of code that when the application loaded up it would read the xml but if it couldnt find an xml file it would create 1, obviously this only happens once when the application is first started, there after it can read it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|