bindingRedirect and COM-interop



I have two different versions of an assembly (3.2.3.0 and 3.3.0.0).
Both are registered for com-interop (by building them with Visual
Studio). They are in separate directories.

I have an unmanaged executable which I want to have use the older
version (3.2.3.0) of the assembly via com-interop. I've verified that
two separate keys are present under InprocServer32 in the registry -
one for each version of the assembly. Under each of these keys the
correct codebase value is present.

My executable is CppTestClient.exe, so I created
CppTestClient.exe.config and placed in the same directory. The file
looks like this:

<?xml version ="1.0?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FleetViewClient"
publicKeyToken="5ba74f079946f741"/>
<bindingRedirect oldVersion="3.3.0.0"
newVersion="3.2.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

When I run the executable it fails, since it expects to find a method
which is not present in the newer assembly (I assume).

The logs from FUSLOGVW.exe (see below) suggest that the config-file is
ignored, since they look the same whether the config-file is there or
not. If i try using the config file on a managed executable, the
redirection works like a charm.

I think it's supposed to work with unmanged executables. Phil Wilson
has a section on it in his execellent book "Definitive guide to Windows
Installer" and this article also describes it:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconconfiguringcomapplicationforside-by-sideexecution.asp

Any suggestions?


*** Assembly Binder Log Entry (31-03-2005 @ 00:24:13) ***

The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from:
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\fusion.dll
Running under executable
C:\Dev\rapidis_vss\Products\FleetViewGeoServices\FleetViewClientSDK\Deployment\CppTestClient\Debug\CppTestClient.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: Where-ref bind. Location =
C:/Dev/rapidis_vss/Sager/FkPostal/Udvikling/FleetViewGeoServices/FleetViewDemo/Development/FleetViewClient/bin/Debug/FleetViewClient.dll
LOG: Appbase =
C:\Dev\rapidis_vss\Products\FleetViewGeoServices\FleetViewClientSDK\Deployment\CppTestClient\Debug\
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
===

LOG: Processing DEVPATH.
LOG: Policy not being applied to reference at this time (private,
custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL
file:///C:/Dev/rapidis_vss/Sager/FkPostal/Udvikling/FleetViewGeoServices/FleetViewDemo/Development/FleetViewClient/bin/Debug/FleetViewClient.dll.
LOG: Assembly download was successful. Attempting setup of file:
C:\Dev\rapidis_vss\Sager\FkPostal\Udvikling\FleetViewGeoServices\FleetViewDemo\Development\FleetViewClient\bin\Debug\FleetViewClient.dll
LOG: Entering run-from-source setup phase.


--------------------------------------------------------------


*** Assembly Binder Log Entry (31-03-2005 @ 00:21:50) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file
specified.

Assembly manager loaded from:
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\fusion.dll
Running under executable
C:\Dev\rapidis_vss\Products\FleetViewGeoServices\FleetViewClientSDK\Deployment\CppTestClient\Debug\CppTestClient.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: DisplayName = FleetViewClient, Version=3.3.0.0, Culture=neutral,
PublicKeyToken=5ba74f079946f741
(Fully-specified)
LOG: Appbase =
C:\Dev\rapidis_vss\Products\FleetViewGeoServices\FleetViewClientSDK\Deployment\CppTestClient\Debug\
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
===

LOG: Processing DEVPATH.
LOG: DEVPATH is not set. Falling through to regular bind.
LOG: Publisher policy file is not found.
LOG: Host configuration file not found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\config\machine.config.
LOG: Post-policy reference: FleetViewClient, Version=3.3.0.0,
Culture=neutral, PublicKeyToken=5ba74f079946f741
LOG: Cache Lookup was unsuccessful.
LOG: Attempting download of new URL
file:///C:/Dev/rapidis_vss/Products/FleetViewGeoServices/FleetViewClientSDK/Deployment/CppTestClient/Debug/FleetViewClient.DLL.
LOG: Attempting download of new URL
file:///C:/Dev/rapidis_vss/Products/FleetViewGeoServices/FleetViewClientSDK/Deployment/CppTestClient/Debug/FleetViewClient/FleetViewClient.DLL.
LOG: Attempting download of new URL
file:///C:/Dev/rapidis_vss/Products/FleetViewGeoServices/FleetViewClientSDK/Deployment/CppTestClient/Debug/FleetViewClient.EXE.
LOG: Attempting download of new URL
file:///C:/Dev/rapidis_vss/Products/FleetViewGeoServices/FleetViewClientSDK/Deployment/CppTestClient/Debug/FleetViewClient/FleetViewClient.EXE.
LOG: All probing URLs attempted and failed.

.



Relevant Pages

  • Fusionlog:
    ... LOG: Where-ref bind. ... LOG: Assembly download was successful. ... Attempting application configuration file download. ...
    (microsoft.public.dotnet.framework)
  • Re: Failed to load resources from resource file Pleas check your Setup
    ... entries in the Fusionlog containing mscorlib: ... Not processing DEVPATH because this is a pre-jit assembly bind. ... Host configuration file not found. ... Attempting download of new URL ...
    (microsoft.public.dotnet.framework)
  • RE: Assembly binding problem
    ... Bind result: hr = 0x0. ... LOG: Using application configuration file: C:\Visual Studio ... Partial reference qualified from config file. ... Attempting download of new URL ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How does perl know its environment.
    ... This is one place where the mindset for Unix and Windows software ... locating any corresponding configuration or other auxiliary files. ... Either the main configuration file is in some fixed ... network-shared drives for storing the executables, ...
    (comp.lang.perl.misc)
  • Re: Aladdin response regarding eSafe
    ... known ITW worms as executables or archives. ... I know this problem it not eSafe specific. ... engines I tested ... OE> fast moving download progress bar. ...
    (Bugtraq)