Is there any open source tool for automatically generating .NET wrappers for a COM DLL library?
问题:
回答1:
You can try to use SWIG which is able to generate wrapper code for 18 languages. Also this MSDN article might be useful.
回答2:
There is no wrapper necessary to use a COM object in .NET. In Visual Studio, right-click your project name in the Solution Explorer, and select "Add Reference." Any registered COM objects will be listed in the COM tab.
Interop wrappers are only necessary when using .NET assemblies as if they were COM objects - not the other way around as you have described in your question.
回答3:
You can use the command line tool for the Type library import tool it will generate an interop assembly for you to use in your project.
The Type Library Importer converts the type definitions found within a COM type library into equivalent definitions in a common language runtime assembly.
If you are using VS.net you will be able to do this through the IDE. Otherwise I believe this tool is freely available (per your open-source request).
回答4:
Yes, the source code for Tlbimp.exe is available. Download it from here...
回答5:
What about tlbimp
typelib importer? MSDN documentation is here.
Hope this helps.