Resolving references used by a C# COM dll at runtime
am 18.01.2008 14:03:01 von MikeLaffertyI have a C# COM dll (using ComVisible, ClassInterface etc) and that dll has a
number of references (other custom dll's). For example MyComProj.dll,
MyComProjReference.dll which live in C:\MyAssemblies
I register the MyComProj.dll using regasm etc.
I can now instantiate the required COM object in this dll if I create a new
exe project that lives in the same folder that. However, I wish to use this
COM dll in a number of other programs, for example, Internet Explorer.
It appears that no matter what you do (gac, config files etc) the .NET
framework refuses to look ANYWHERE else apart from the application folder -
not even in the GAC!! Surely, I've missed something somewhere and support
for creating COM objects in C# is not this poor.
Below is the first error log (of a number of failures) from the Assembly
Binding log view:
*** Assembly Binder Log Entry (18/01/2008 @ 11:31:15) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files (x86)\Internet
Explorer\iexplore.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = MICL-NET\mnl
LOG: DisplayName = stdole, Version=7.0.3300.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/Internet Explorer/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = iexplore.exe
Calling assembly : MyComProj, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=24cc1a8168bea492.
===
LOG: Start binding of native image stdole, Version=7.0.3300.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
WRN: No matching native image found.