Assembly.GetExecutingAssembly() available in .NET Core?

If you are targeting .NET Standard 1.5 or above, you may call any of the following:

System.Reflection.Assembly.GetExecutingAssembly();
System.Reflection.Assembly.GetEntryAssembly();
System.Reflection.Assembly.GetCallingAssembly();

If targeting earlier versions of .NET Standard then the typeof(SomeClass).GetTypeInfo().Assembly method is the only way.

Leave a Comment