Error CS0117 "Assembly" does not contain a definition for "GetExecutingAssembly"

var AppDirectory = ((new DirectoryInfo(Assembly.GetExecutingAssembly().Location)).Parent).FullName 

I use NetCoreApp 1.1 . Missing GetExecutingAssembly

But it works fine when using NetFramework 4.5.2

  • How about AppDomain.CurrentDomain.BaseDirectory ? - Monk
  • one
    @Monk: There seems to be no domains there. - VladD

1 answer 1

 var location = System.Reflection.Assembly.GetEntryAssembly().Location; var directory = System.IO.Path.GetDirectoryName(location); System.Console.WriteLine(directory); 

Output

 C:\MyApplication\bin\Debug\netcoreapp1.0