Search code examples
c#wpfinstallationdllregistrationvdproj

Running my Setup project causes "module failed to register" error


I'm trying to deploy my project and create an installer. I've created a .vdproj, that has an output setup.msi When running the .msi setup wizard, i'm getting the error:

"Module xyz failed to register. HRESULT -2147024769. Contact your support personnel."

The module that failed to register is a C++ dll, while my application is a WFF-C# appliction.

Does anyone know of a solution for this problem?


Solution

  • The installer complains that it cannot find the exported function in the DLL to register it, the DllRegisterServer function. Very good odds that you asked the installer to register the DLL when it is not in fact a COM server. Not every C++ dll is a COM dll. Most are not.

    You ought to be able to see this in the way you use the DLL in your code. You typically use a COM dll by adding a reference to the DLL or type library and you'll have an Interop.Foo.dll assembly in your build directory. Conversely, you use a non-COM dll in your code with the [DllImport] attribute.

    Change the "Register" attribute for the DLL back to vsdrpDoNotRegister and try again.