System.IO.DirectoryNotFoundException: 'Could not find a part of the path 'C:\Users\admin\development\project31\bin\Debug\netcoreapp2.0\resources\logging\debug.log'.'
This happens on the following line...
var fileWriter = new StreamWriter(executionPath + "/resources/logging/" + file, true);
Full code:
private static void LogToFile(string file, string content)
{
var executionPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
var fileWriter = new StreamWriter(executionPath + "/resources/logging/" + file, true);
fileWriter.WriteLine(content);
fileWriter.Close();
}
The issue is, its going into the netcoreapp2.0
folder, when all I want it to go into is the debug.
I could just back up 1 directory, but I know if I use this code in .NET framework not .NET core it will break again due to .NET framework not running debug in netcoreapp2.0