.NET COM Component creation failed in 64bit process even Assembly platform target is AnyCPU


After a .NET Component is compiled with COMVisable true flag, we can use this way to deploy it easily:

regasm.exe /tlb DOTNETCOM.dll /Codebase

However, if the caller process is 64bit, and the .NET component platform target is AnyCPU, you may still experience CreateObject failure. This is unexpected because we know AnyCPU assemblies should work well in 64bit host process.

The root cause of this issue can be various, mainly are two:

1. Some references of this Component is 32bit and not ready for AnyCPU

2. The ragasm.exe is 32bit and it only covers 32bit registration.

Regarding point one, we can:

a. Collect Process Monitor trace, to see if the host process loading any assembly in x86 folder.

b. Enable fusion log, identify any assembly loading failure issue. Don’t forget give the output folder enough permission to write data.

Regarding point two, Process Monitor will show the host process tried to read Wow64 registry key. We just need to use 32bit and 64bit regasm together in this way:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe /tlb DOTNETCOM.dll /Codebase

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe /tlb DOTNETCOM.dll /Codebase


Freist Li from GBSD DSI Team

Comments (0)

Skip to main content