"类未注册(HRESULT异常:0x80040154(REGDB_E_CLASSNOTREG))"

use*_*809 24 c#

我正在尝试使用一个应用程序,该应用程序工作正常,我正在尝试编辑应用程序中的现有项目.点击编辑时出现以下错误,

System.Runtime.InteropServices.COMException was unhandled
  Message="Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"
  Source="System.Windows.Forms"
  ErrorCode=-2147221164
  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 bulk_lister.frm_edititem.InitializeComponent() in New Bulklister\new bulklister\bulk_lister\bulk_lister\frm_edititem.designer.cs:line 4248
       at bulk_lister.frm_edititem..ctor(Int32 userid, Int32 intListingId) in New Bulklister\new bulklister\bulk_lister\bulk_lister\frm_edititem.cs:line 187
       at bulk_lister.parent_form.funEditItem_fromrghtclktoolStrip_edititm() in New Bulklister\new bulklister\bulk_lister\bulk_lister\parent_form.cs:line 1313
       at bulk_lister.parent_form.rghtclktoolStrip_edititm_Click(Object sender, EventArgs e) in New Bulklister\new bulklister\bulk_lister\bulk_lister\parent_form.cs:line 1233
       at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at bulk_lister.Program.Main() inNew Bulklister\new bulklister\bulk_lister\bulk_lister\Program.cs:line 17
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
       at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
       at System.Activator.CreateInstance(ActivationContext activationContext)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
Run Code Online (Sandbox Code Playgroud)

它与我用于我的应用程序的Dll文件.我试图使用regsvr32注册这个DLL文件但我无法做到.

DLL:AxInterop.DHTMLEDLib.dll & Interop.DHTMLEDLib.dll
Run Code Online (Sandbox Code Playgroud)

有没有人对这个例外有所了解?

Blo*_*oon 35

您的应用程序的目标平台是什么?我认为您应该将平台设置为x86,不要将其设置为Any CPU.


Rus*_*lan 13

这可能不是你的问题的解决方案,但建议以防万一(我知道我之前遇到过类似的问题,但没有使用.NET应用程序).

如果您使用的是64位计算机,则有2个 regsvr32.exe文件; 一个在\Windows\System32 ,另一个在\Windows\SysWOW64.

您不能使用32位版本注册64位COM对象,但您可以反之亦然.我试着regsvr32.exe明确地用两个文件注册你的DLL (即输入" C:\Windows\System32\regsvr32.exe /i mydll.dll"然后" C:\Windows\SysWOW64\regsvr32.exe /i mydll.dll"),看看是否有帮助......

  • 我试过这个但是收到错误"MYDll.dll已加载但未找到DllRegisterServer"对此有何帮助? (10认同)
  • @ user1462809调用没有"/ i"的regsvr32.exe解决了我的问题. (4认同)
  • 没有帮助我,但我仍然想知道为什么他们没有将其命名为 regsvr64.exe...是不是太难了? (2认同)

Ait*_*azk 7

当我将框架从4.5更改为4时,我得到了与vlc组件相同的错误.但是当我将平台从Any CPU更改为x86时,它对我有用.


小智 5

我今天偶然发现了一个 DLL,我知道它在我的 VS2013 项目中运行良好,但不适用于 VS2015:

去: Project -> XXXX Properties -> Build -> Uncheck "Prefer 32-bit"

这个答案已经过期了,可能不会有任何好处,但如果你。但我希望有一天这会对某人有所帮助。