You can use the Type Library Importer (Tlbimp.exe) to create an interop assembly which will allow your .NET application to use a type defined in it.
How to use Tlbimp.exe:
- Open a Visual Studio Command Prompt (under the "Visual Studio Tools" menu of the "Start" menu)
- Use "Tlbimp.exe /?" or "Tlbimp /help" to see the usage message.
- Sample:
Tlbimp.exe C:\test\MSO9.dll (By default, it will generate the file base on the name of the type library contained within the original COM dll file.)
Tlbimp.ee C:\test\MSO9.dll /out:NewNameOffice.dll (Or you can use /out to specify the name of output file.) - The namespace of the imported library uses the same name as that of the library from which it was created by default. You can use this to change the namespace:
Tlbimp.exe MSO9.dll /namespace:MyNewNameSpace
After you create the new assembly dll by using Tlbimp.exe, you can then add a reference to it and use the types just as you would use a native .NET Framework type.
For more information about Tlbimp.exe, you can visit here: http://msdn.microsoft.com/en-us/library/tt0cf3sx.aspx
No comments:
Post a Comment