How to: Add References to Type Libraries
Visual Studio generates an interop assembly containing metadata when you add a reference to a type library. If a primary interop assembly is available, Visual Studio uses the existing assembly before generating a new interop assembly.
To add a reference to a type library in Visual Studio
Install the COM DLL or EXE file on your computer, unless a Windows Setup.exe file performs the installation for you.
From the Project menu, select References.
Select the COM tab.
Select the type library from the Available References list, or browse for the .tlb file.
Click OK.
Right-click the newly added reference, and and then click Properties.
In the Properties window, make sure that the Embed Interop Types property is set to True. This causes Visual Studio to embed type information for COM types in your executables, eliminating the need to deploy primary interop assemblies with your application.
To add a reference to a type library for command-line compilation
Generate an interop assembly as described in How to: Generate Interop Assemblies from Type Libraries.
Use the /link (C# Compiler Options) or /link (Visual Basic) compiler option with the interop assembly name to embed type information for COM types in your executables.
See Also
Tasks
Walkthrough: Embedding Type Information from Microsoft Office Assemblies (C# and Visual Basic)
Walkthrough: Embedding Types from Managed Assemblies (C# and Visual Basic)