Is there an event that we can hook to, that gets called BEFORE an assembly is resolved.
For example if some code in the AppDomain is calling Assembly.Load(path) , the event will be raised, saying this assembly is attempted to be loaded?
This can be useful for redirecting possible assembly loads that are hardcoded in some components.
Doing this also from configuration is a valid option, if possible.
Any suggestions ?
It appears, from the documentation, that no event is thrown right at the start of this process. Therefore, I suggest (if possible), that you write something like the following and use it through-out:
Then, you can use this method anywhere in your code when you want to load an assembly.
Obviously you might want to use a proper object here in that delegate (not just the path) to prevent loading of the assembly or do something different.