Assume I have a simple script writing in C# 9 like this:
using System;
using System.IO;
// What to put in the ???
var exeFolder = Path.GetDirectoryName(typeof(???).Assembly.Location);
Before, with the full program, we can use the Main class as an "indicator" class. this and this.GetType() is not available because technically it's inside a static method. How do I get it now?
A workaround I thought of while typing the question is Assembly.GetCallingAssembly():
var exeFolder = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location);
It works for my case, but I can only get the Assembly, not the TypeInfo that in which the code is running.