Created
June 23, 2020 14:21
-
-
Save kevingosse/fef3757491933a4847cbead4e7cedc5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StartupAssemblyLoadContext : AssemblyLoadContext | |
{ | |
private readonly AssemblyDependencyResolver _resolver; | |
public StartupAssemblyLoadContext() | |
{ | |
_resolver = new AssemblyDependencyResolver(Assembly.GetExecutingAssembly().Location); | |
} | |
protected override Assembly Load(AssemblyName assemblyName) | |
{ | |
string assemblyPath = _resolver.ResolveAssemblyToPath(assemblyName); | |
if (assemblyPath != null) | |
{ | |
return LoadFromAssemblyPath(assemblyPath); | |
} | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment