i’m fairly new to writing with CSVhelper, and I’m trying to make a console application that converts one file’s data into a CSV file, using OpenFileDialog with the sytem.windows.forms assembly. However, when I swap my target OS to windows, (which allows me to use openfiledialog and such) CSVhelper will not create the file in the debug folder (aka where the target output is currently)
var csvPath = Path.Combine(Environment.CurrentDirectory, $"SpreadsheetConverter-{DateTime.Now.ToFileTime()}.csv");
using (var streamWriter = new StreamWriter(csvPath))
{
using (var csvWriter = new CsvWriter(streamWriter, CultureInfo.InvariantCulture))
{
csvWriter.WriteRecords(newList); // newlist being a custom class object that csvhelper will print out each row 1 at a time on the csv page.
}
}
Swapping the OS back to none fixes the problem, but I cannot really use OpenFileDialog without changing it to windows.
I’m sorry if i’m not really explaining this well, i’m pretty new to this stuff. but any answers are appreciated.
J. Kits is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.