0

I have a C# ComServerProject that implements an out-of-proc COM server, and I've selected the option "Make assembly COM-visible" on server project's "Assembly Information" dialog. In the same solution I have a C++ ComClientProject that should use the COM interface defined in ComServerProject. However, I don't know how to actually use the interface defined in the server in my C++ client.

All of the Google search results say that you should do #import "ComServerProject.tlb" to import the type library from the COM server. But there is no .tlb file created during the build! I also tried checking the "Register for COM interop" box on the Build tab of the server project properties, but it still didn't create a .tlb file. Plus, it required me to run VS elevated, which I would like to avoid.

How can I get VS2010 to actually create whatever files are necessary to have a usable COM server?

1 Answer 1

1

Use Tlbexp on the generated assembly to create the .tlb.

Something like:

tlbexp ComServerProject.dll /out:ComServerProject.tlb
Sign up to request clarification or add additional context in comments.

3 Comments

Do I need an explicit post-build step for that, or can I somehow convince VS to do it for me?
I am not aware of any way of getting VS to call tlbexp without resorting to a post build step.
you can: in Visual Studio 2010, tick the "Register for COM interop" box under "Build" for the assembly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.