Error 0x8013101b when doing a registration free COM activation

Jenfeng’s blog discusses in details about registration free COM/ .Net interop. Please see blogs.msdn.com/b/junfeng/archive/2006/05/17/registration-free-com-net-interop.aspx for a reference.

The error 0x8013101b stands for COR_E_NEWER_RUNTIME which means "A module specified in the manifest was not found". For example this might happen if an EXE trying to create a COM object was targeting version 2.0 of the .Net framework and the COM DLL was build using .Net 4.0 of the framework. To troubleshoot this further you might capture fusion logs.

Using an application configuration file which targets the correct runtime might resolve the issue. For example if you would like to target a .Net 4.0 runtime, a configuration file entry could be as shown below:

<?xml version="1.0"?>

<configuration>

<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>

</configuration>

 

The MSDN link at msdn.microsoft.com/en-us/library/ff770241.aspx describes the possible ways to configure your .NET Framework applications to run on the .NET Framework version 4 without recompiling them.

I created a sample where an EXE trying to create a COM object was targeting version 2.0 of the .Net framework and the COM DLL (assembly) was built using .Net 4.0 of the framework. When I was not using the configuration file (with entries shown above) I got error 8013101b and fusion logs showed me the following entries:

 

<meta http-equiv="Content-Type" content="charset=unicode-1-1-utf-8"><!-- saved from url=(0015)assemblybinder: --><html><pre>

*** Assembly Binder Log Entry  (8/8/2012 @ 10:33:24 AM) ***

 

The operation failed.

Bind result: hr = 0x8013101b. No description available.

 

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll

Running under executable  D:\Registration_Free_COM\test_client.exe

--- A detailed error log follows.

 

=== Pre-bind state information ===

LOG: User = shmisra

LOG: DisplayName = sidebyside, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

(Fully-specified)

===

LOG: This bind starts in default load context.

LOG: Download of application configuration file was attempted from .

LOG: Configuration file D:\Registration_Free_COM\test_client.exe.config does not exist.

LOG: No application configuration file found.

LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

LOG: Attempting download of new URL .

LOG: Assembly download was successful. Attempting setup of file: D:\Registration_Free_COM\sidebyside.dll

LOG: Entering run-from-source setup phase.

ERR: Error extracting manifest import from file (hr = 0x8013101b).

ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated.

 

</pre></html>

As you can notice, the EXE is targeting version 2.0 of the .Net framework. After using the configuration file with entries stated above the issue was resolved and I see the following entries from fusion logs:

<meta http-equiv="Content-Type" content="charset=unicode-1-1-utf-8"><!-- saved from url=(0015)assemblybinder: --><html><pre>

*** Assembly Binder Log Entry  (8/8/2012 @ 10:37:12 AM) ***

 

The operation was successful.

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

 

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll

Running under executable  D:\Registration_Free_COM\test_client.exe

--- A detailed error log follows.

 

=== Pre-bind state information ===

LOG: User = FAREAST\shmisra

LOG: DisplayName = sidebyside, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

(Fully-specified)

===

LOG: This bind starts in default load context.

LOG: Download of application configuration file was attempted from .

LOG: Found application configuration file (D:\Registration_Free_COM\test_client.exe.Config).

LOG: Using application configuration file: D:\Registration_Free_COM\test_client.exe.Config

LOG: Using host configuration file:

LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

LOG: Attempting download of new URL .

LOG: Assembly download was successful. Attempting setup of file: D:\Registration_Free_COM\sidebyside.dll

LOG: Entering run-from-source setup phase.

LOG: Assembly Name is: SideBySide, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

LOG: Binding succeeds. Returns assembly from D:\Registration_Free_COM\sidebyside.dll.

LOG: Assembly is loaded in default load context.

 

</pre></html>

See the EXE is targeting version 4.0 of the .Net framework.

For more details please refer to Junfeng’s blog at blogs.msdn.com/b/junfeng/archive/2006/05/17/registration-free-com-net-interop.aspx.

 

Thanks,

Shamik