System.DllNotFoundException: Unable to load DLL 'XX.dll': 找不到指定的模块。 (Exception from HRESULT:

    自己是做C#上位机开发的,在公司一个项目中,需要由下位机开发的同事给到C++写的dll供上位机调用,在win10的64位上开发的程序,到了win7的64位上使用不了,以下是报错内容:

System.DllNotFoundException: Unable to load DLL 'XX.dll': 找不到指定的模块。 (Exception from HRESULT: 0x8007007E)    at XX.IOPTesterDriver.EPDevSearch()    at LibIOP.IOPTesterManager.Search()    at EIOPTester2._1.RunPlans.wizard1_Load(Object sender, EventArgs e)    at System.Windows.Forms.UserControl.OnLoad(EventArgs e)    at System.Windows.Forms.UserControl.OnCreateControl()    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)    at System.Windows.Forms.Control.CreateControl()    at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)    at System.Windows.Forms.ScrollableControl.OnVisibleChanged(EventArgs e)    at DevComponents.DotNetBar.PanelEx.OnVisibleChanged(EventArgs e)    at System.Windows.Forms.Control.OnParentVisibleChanged(EventArgs e)    at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)    at System.Windows.Forms.ScrollableControl.OnVisibleChanged(EventArgs e)    at System.Windows.Forms.Form.OnVisibleChanged(EventArgs e)    at DevComponents.DotNetBar.OfficeForm.OnVisibleChanged(EventArgs e)    at System.Windows.Forms.Control.SetVisibleCore(Boolean value)    at System.Windows.Forms.Form.SetVisibleCore(Boolean value)    at System.Windows.Forms.Control.set_Visible(Boolean value)    at EIOPTester2._1.MDIParent.SetTabShow(String tabName, String sfrmName)

    最后参考一位大神的博客找到了解决方案,那就是:

打开所引用的dll源码的项目属性页面,配置属性 -> C/C++ -> 代码生成 -> 运行库,将该项设置为 多线程调试 (/MTd),然后再重新生成解决方案,使用新的dll即可解决问题

    注:博主此处的dll之前为150+kb,运行库那一项为“多线程 DLL (/MD)”,改变为“多线程调试 (/MTd)”后变大为870+kb

参考贴链接如下:https://blog.csdn.net/songtzu/article/details/49429181

你可能感兴趣的:(C++,C#)