首页 > 解决方案 > 无法加载文件或程序集异常 HRResult: 0x80131044

问题描述

我正在从事一个项目,该项目是我从无法再提供帮助的其他人那里继承而来的。

在执行应用程序期间,我收到以下错误

    ************** Exception Text **************
    System.IO.FileLoadException: Could not load file or assembly 'Jasper.SharedCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
    File name: 'Jasper.SharedCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
       at SysUserInterfaceUtil.GridPopUpMenu.DoExport(String fileName, ExportTypes exportType)
       at SysUserInterfaceUtil.GridPopUpMenu.exportXML_ItemClick(Object sender, ItemClickEventArgs e)
       at DevExpress.XtraBars.BarItem.OnClick(BarItemLink link)
       at DevExpress.XtraBars.BarButtonItem.OnClick(BarItemLink link)
       at DevExpress.XtraBars.BarItemLink.OnLinkClick()
       at DevExpress.XtraBars.BarButtonItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
       at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.UnPressLink(BarItemLink link)
       at DevExpress.XtraBars.Controls.CustomLinksControl.OnMouseUp(MouseEventArgs e)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at DevExpress.XtraBars.Controls.CustomControl.WndProc(Message& msg)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

据我所知,SysUserInterfaceUtil 没有引用 Jasper.SharedCode。我该如何解决这个问题?我需要签署 Jasper.SharedCode 吗?有没有办法在不签署 Jasper.SharedCode 的情况下解决这个问题?

标签: c#

解决方案


如果该库确实被您引用的某个其他库使用,则问题可能是强名称绕过已停用。自 .NET 3.5 起绕过强名称。

检查注册表中的这些设置(取决于您的操作系统位数):

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework

如果 KeyAllowStrongNameBypass存在且值为0,则将值设置为1

有关强名称绕过的更多信息:https ://docs.microsoft.com/en-us/dotnet/framework/app-domains/how-to-disable-the-strong-name-bypass-feature


推荐阅读