I’m creating a simple .NET console application where I want to save a file in a folder that’s part of the root project, like so: SolutionName.ProjectName\TestData\. I want to put test.xml into the TestData folder. However, when I go to save my XDocument, it saves it to SolutionName.ProjectName\bin\x86\Debug Console\test.xml.
What do I need to do to save or retrieve the file in a folder that is a child of project directory?
Your console application is, once compiled, not really related to your Visual Studio solution anymore. The best way is probably to simply ‘feed’ the output path to your application as an command line argument:
Now you can run your application like so: