In .net framework we could get the starting assembly using:
Assembly.GetEntryAssembly();
But that is removed from .NET Core. Also there is
I ended up injecting the entry assembly into the library.
In the library:
class AssemblyHelper
{
// This can be called instead of Assembly.GetEntryAssembly()
public static Func GetEntryAssembly;
}
In the start-up application (which uses the library):
class Program
{
public static void Main()
{
AssemblyHelper.GetEntryAssembly = () => typeof(Program).GetAssembly();
....
}
}