In C #, if we need to call APIs and other com-type functions, but most of the time the system calls the DLL for me every month, it is okay to have a TLB file. VS can be directly referenced, however, in many cases, the reference is unsuccessful. To get a C # automatically encapsulated com InterOPProgramSet, we can do this:
1.use midl.exe: use the format midl.exe IDL file name. This tool generates a TLB file. If the file can be referenced directly by Vs to generate an InterOP assembly, the following steps are not required.
2.use tlbimp.exe: Use tlbimp.exe TLB file name. This tool will generate a. Net standard assembly and apply it directly.
3. To obtain the source code of the InterOP assembly, you must adjust it automatically. You can also use reflector to generate a CS file. Join the project directly.
Original article address:
Http://blog.csdn.net/gangzai/article/details/2632792