Subir Nath
Subir Nath

Reputation: 21

Generated Interop Assembly from a C++ COM dll gives build reference error

I am trying to migrate my 32 bit application to x64bit, in my application I have a C++ COM dll which I have build in x64 configuration. I am generating the Interop Assembly of the COM C++ dll using the command

        TLBIMP faacom.dll /out:Interop.FAACOMLib.dll

I have another C# project (Configuration - Any CPU) in which I am adding a reference of the above Interop dll. But when I try to build my C# project it gives build error even when it is pointing to the correct path:

Error 1 The type or namespace name 'FAACOMLib' could not be found (are you missing a using directive or an assembly reference?)

But when I use the same Interop dll in my C# project which was generated from the 32bit compiled version of my C++ COM dll I do not get any build error.

I have tried generating the interop dll using x64 TLBIMP.exe but does not works.

Any Suggestions. Please Help...!!!

Thanks in Advance

Upvotes: 0

Views: 1662

Answers (1)

christianO
christianO

Reputation: 187

I had the same problem. Apparently when you change the name of the DLL in the out-parameter of tlbimp, it changes the namespace as well for some reason. You can manually change the namespace with the namespace parameter. The command below should work I think.

TLBIMP faacom.dll /out:Interop.FAACOMLib.dll /namespace:FAACOMLib

Upvotes: 3

Related Questions