COM Interop registration failed for Interface only DLL

  • Thread starter Thread starter Eric St-Onge
  • Start date Start date
E

Eric St-Onge

Hi all,

I have a C# DLL containing only interfaces that I want to have a TLB (type
library) generated for.

For that I use the "Register for COM Interop" compiler option but it gives
me the error

*******************
Building satellite assemblies...
Registering project output for COM Interop...
COM Interop registration failed. There are no registrable types in the built
assembly.
---------------------- Done ----------------------

Build: 0 succeeded, 1 failed, 0 skipped
*******************

Even with this error my TLB was well generated but it makes my build script
think that the build didn't succeed, which is not acceptable for me.

I understand why this is happening: this is because there are no types in my
assembly that are creatable. But that shouldn't lead to an error but rather
to a simple warning?? right? (please correct me if I am wrong)

Anybody knows a workaround so that my TLB will get generated and my build
result will not be a failure?

(from what I remember back in time using VB6 and VC6, it was acceptable to
have COM DLLs composed uniquely of "PublicNonCreatable" COM objects...)

Thanks
Eric
 
So you are suggesting to not use the "Register COM Interop" option in VSNET2003 and rather use a PostBuild step that will call TlbExp..

Using PostBuild steps it is also possible to call
regasm myasm.dll /TLB:myasm.tlb

which produces the same effect without errors (compared to VSNET2003 check box) and additionnaly registers the tlb in the registry.

Thanks for your help
Eric
 
Oops, small problem!

It appears that VSNET2003, by default, is not able to find regasm when used in post build steps!!!
Is there a way to solve that ? (hardcoding the path to the file is not acceptable because it won't work when others will build the solution)

If I use TLBEXP, will my tlb registered in the registry?
If not, how do I have it registered?

Thanks
Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top