Replacement for AppDomain.GetLoadedAssemblies() in .NET Core?

.net, .net-core, asp.net-core, c#

Solution

Fixed this by upgrading my `.netstandard` projects from `1.4` to `1.6`. The package `Microsoft.Extensions.DependencyModel 1.1.2` now works.

Edit:

Using `.netstandard2.0` removes the need for an `AppDomain` polyfill class since it contains many more .NET APIs including `System.AppDomain`

Problem

I'm trying to write some logic to mirror some existing logic in an original .NET application. In my `OnModelCreating()` method I want to load all current types in loaded assemblies to find the ones that need to be registered for entity type configuration in the model. This was done in .NET with `AppDomain.CurrentDomain.GetAssemblies().Select(a => a.GetTypes())`, however `AppDomain` no longer exists in .NET Core. Is there a new way to do this? I have seen some examples online of using `DependencyContext.Default.RuntimeLibraries` however `DependencyContext.Default` does not seem to exist anymore either. Edit: I have found now that adding `Microsoft.Extensions.DependencyModel` to a `.netcoreapp1.1` project works. However I am actually writing a solution with multiple projects and I somehow need do this type loading in my `.netstandard1.4` project where my DbContext implementation and entity type configuration is

Original source