Question

I've some applications that rely on some shared components. I am moving these shared assemblies outside of application local directory to a shared directory. My goal is that each time a new version of shared assembly is released, I only have to place new version inside shared directory and do not have to change anything in my applications. I think assemblyResolve event is a good solution for this. I've a specific question to ask on the way the handler works.

Suppose I attach this handler to resolve missing assemblies from a shared directory. I use just the assembly name to find the corresponding dll in the directory and load it using Assembly.LoadFrom(dllpath).

My application references assembly: name:A,version:1.0,publickey:... The assembly is upgraded to version:2.0 I place the new assembly in the shared directory.

Will the application pick up the new version properly? Does C# do any matching after the new assembly is loaded and returned from the handler?

From my tests, it works fine. .NET ignores the version when registering the assembly returned from handler. I just want to make sure I am not wrong and there are no caveats

thanks

Was it helpful?

Solution

It is explicitly mentioned in the MSDN article:

The event handler can return a different version of the assembly than the version that was requested.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top