Sunday, September 3, 2017

no more AppDomain.CurrentDomain.BaseDirectory?

I created a .NET Core frontend project in Visual Studio 2017 and bolted on some traditional C# projects to the solution and then this trick didn't work in one of the C# class libraries for finding out where on was. AppDomain was red in Visual Studio like it could not be found. I settled for this instead:

string path = System.IO.Path.GetFullPath("Presidents.csv");

 
 

Even though Presidents.csv sat right next to the C# file I was using to find it and both files where not in the .NET Core UI, the path that came back was nonetheless a path to the folder for the UI with "Presidents.csv" bolted onto the end. Huh? I guess I don't really know how to manipulate this stuff yet. I was able to doctor the path that I was given into something I could use.

No comments:

Post a Comment