在我的应用程序中使用dll AxDrawingControl
(v4.0.30319)中的AxInterop.Microsoft.Office.Interop.VisOcx.dll
时,我收到以下异常:
System.Runtime.InteropServices.COMException occurred
HResult=-2147221164
Message=Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Source=System.Windows.Forms
ErrorCode=-2147221164
The stackTrace:
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()
at TestVisOcxAxDrawing.VisioTestForm.InitializeComponent() in C:\ TestVisio\TestVisOcxAxDrawing\VisioTestForm.Designer.cs:line 55
InnerException:
Visio安装是Professional 2010,x86版本。
到目前为止,我的观察结果如下:
不幸的是,上述解决办法在我的情况下是不可能的,因为它是一次点击应用程序,并且客户端可以在安装了任何Visio版本的任何版本的Windows上运行。
问题:
是否有任何替代方案/最佳做法来处理此类情况?
重建
的步骤Any CPU
- > Active Solution Platform
。Choose Items
- >导航到COM Components
标签 - >查看Microsoft Office Visio 14.0 Drawing Control
。Microsoft Office Visio 14.0 Drawing Control
控件拖到表单中,然后按F5
。Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
错误会突然出现。谢谢你, 问候, 普利文