AxImp Generated Reference
I've recently been working on a C#/VS2008 project which requires 3 ActiveX controls. I created a .NET wrapper using AxImp.exe
for the controls, and added them as r开发者_C百科eferences to my project. The code had been working without any trouble for a few days.
Yesterday, I pulled a clean version from our version control server (the wrapper DLLs were included, but not the ActiveX controls themselves), and when I attempted to run the program, I get a COMResultException
with HRESULT = REGDB_E_CLASSNOTREG(0x80040154)
during the InitializeCompnent
call of the parent form.
Any clues on what might have happened to cause this?
Not sure what "clean version" means but clearly the GUIDs in the interop library no longer match the GUIDs used by the ActiveX controls. Getting 0x80040154 is the result, it can no longer find the ActiveX registry keys.
Controlling the build process and keeping the ActiveX controls in sync with the interop wrappers is pretty important or you'll be battling this problem long-term. Generating them ought to be associated with building the controls. This can be especially a problem if the controls were created in VB6. It is quick to assign new GUIDs unless you setup its binary compatibility feature.
精彩评论