Easy COM interop in Visual Studio usually involves adding a reference to your project within the IDE, which magically produces interop assemblies in your project’s obj directory. These assemblies generally contain all the auto-generated marshalling crap you need, and life is good.
However, if you need to build your project on a build machine that doesn’t have all of your COM component dependencies installed on it, or if you need to collaborate with another developer who doesn’t necessarily want to install/register the components, you need to be able to manually create these interop assemblies. To do this, simply point the
tlbimp.exe tool (for regular COM controls) or the
aximp.exe (for ActiveX controls that want an Ax*.dll wrapper for WinForms) at the DLL or OCX to generate the needed assemblies. Place these new DLLs into a lib directory of your choosing in your project; when you replace your existing interop references with references to these files, you’ll be build-machine-friendly.