开发者

Creating a C++ COM client for C# COM server

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 def开发者_JAVA百科ined 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?


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

Something like:

tlbexp ComServerProject.dll /out:ComServerProject.tlb
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜