Search code examples
c#cominteropregsvr32

C# - Register a third party COM DLL during a pre-build event


I have a dependency on several COM components. My project is managed. I want to ensure that the most recent version of the COM DLL is registered pre-build. I have added regsvr32 calls on the DLLs in the pre-build step but it never seems to work correctly. When the project is built it complains that the type isn't registered. I have both isolated and non-isolated components.

How do people handle this situation? Is regsvr32 the only answer? Why does MSBuild fail to notice that the types have been registered?


Solution

  • Regsvr32 is the way to register your typelib and COM server information in the registry. It's a trivial process, and I'm suprised that it doesn't work. Have you hand verified the process to make sure its not something else, like supplying the wrong path to regsvr32?