-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assembly.Load does not find assembly in the application base directory #8045
Comments
Yes, this is by design for .NET Core. https://github.com/dotnet/coreclr/blob/master/Documentation/design-docs/assemblyloadcontext.md talks about how assembly loading works in .NET Core. |
@gkhanna79 if it is by design, can we close it? |
Seems like a bit of an odd design choice. Makes it hard to use the Assembly.Load* methods on existing assemblies. For example I have A.dll which references B.dll. I place both files in the application folder and use Assembly.LoadFrom to load A. I then use a bit of reflection to invoke a method on A which uses something in B and I end up with a I managed to work around it with |
The assembly binding behavior is, by design, distinctly different between Desktop and .NET Core. In 1.0, it happened to work due to a bug in the host that was fixed in 1.1. Assembly.LoadFrom is a .NET Framework API that has been supported in 2.0 and for it, we emulate the desktop behavior. |
Also see dotnet/core-setup#2717 (comment) |
@jkotas
|
FWIW This is the runtimeconfig.json that works for me: { As best I can tell it gets used by the default dotnet.exe host here: |
I tried the following:
which results in a
FileNotFoundException
. Works fine with .NET Framework.All the documentation I'm finding relates to the .NET Framework and says that Assembly.Load will do probing in the application base directory if it fails to find the assembly elsewhere. If .NET Core is supposed to behave differently is there some documentation outlining the differences?
I guess as a workaround I could use
AssemblyResolve
and implement the probing myself?The text was updated successfully, but these errors were encountered: