Is there any way to write a class that wraps around the CLR? Basically we
have an ASP.NET application that has had some core DLL's renamed (the product
has been renamed) and we're wanting to still preserve compatibility with
customer developed plugins.
For example, previously, we had a DLL named "BusinessManager.Data.dll", what
we're wanting to do is basically intercept the call to load that DLL and
instead redirect it to "Portfolio.Data.dll" (all we're doing is replacing
BusinessManager with Portfolio). Does the .NET framework support this? Is
there any way we could accomplish that by throwing an entry into the
web.config file?
Thanks a ton,
Tony Valenti
David Browne - 06 Jan 2006 00:12 GMT
> Is there any way to write a class that wraps around the CLR? Basically we
> have an ASP.NET application that has had some core DLL's renamed (the
[quoted text clipped - 10 lines]
> there any way we could accomplish that by throwing an entry into the
> web.config file?
Why don't you just provide a new implementation of
"BusinessManager.Data.dll" which is a facade for "Portfolio.Data.dll"?
David
Tony Valenti - 06 Jan 2006 01:39 GMT
We're wanting to have as little impact on the existing infrastructure.
john conwell - 06 Jan 2006 19:23 GMT
Well, sort of. you cant do it (i think) in .Net with C# or VB.Net. You
could do it with C++ by writing your own CLR host exe. The book 'Customizing
the Microsoft® .NET Framework Common Language Runtime ' tells you how to do
this.
Actually, after looking in MSDN, the AppDomain's AssemblyResolve Event looks
like it might work for you. AssemblyResolve event gets called when the CLR
tries to load an assembly, but it cant find it. the event's return type is
an assembly. So if your dll isnt there, you can basically manually load
whatever assembly you wanted and return it. maybe
> Is there any way to write a class that wraps around the CLR? Basically we
> have an ASP.NET application that has had some core DLL's renamed (the product
[quoted text clipped - 10 lines]
> Thanks a ton,
> Tony Valenti
Tony Valenti - 08 Jan 2006 09:16 GMT
Very Nice! That is exactly what I was looking for. Do you know if there is
something similar to that involving classes?
Tony Valenti - 08 Jan 2006 09:21 GMT
It looks like I can do it through
System.Reflection.Assembly.GetExecutingAssembly().ModuleResolve += new
System.Reflection.ModuleResolveEventHandler(Program_ModuleResolve);