C#无法加载DLL(模块找不到HRESULT:0x8007007E) [英] C# Unable to load DLL (Module could not be found HRESULT: 0x8007007E)

查看:151
本文介绍了C#无法加载DLL(模块找不到HRESULT:0x8007007E)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:无法加载DLL'x.dll':找不到指定的模块。 (来自HRESULT的异常:0x8007007E)



操作系统:Windows 7



使用.net 4.0;另一个没有VS安装
在VS2012的第一站我有一个C#解决方案与C ++项目导入。
我使用的是:

  [DllImport(x.dll,CallingConvention = CallingConvention.Cdecl)] 
[return:MarshalAs(UnmanagedType.I4)]

p>

但是当我在另一个站(没有安装VS)上移动时,它出现了错误。
如果我安装VS,它的工作。



这个问题发生的可能原因是什么?关于我可能缺少什么或者如何调试这个问题的任何想法?

解决方案

最可能的原因是,没有安装Visual Studio缺少您的非托管DLL所需的C ++运行时。从可下载的可再发行组件安装相应的C ++运行时。



请确保您的非托管DLL链接到发布运行时而不是调试运行时。



您可以使用像Dependency Walker,Process Monitor等工具来调试非托管DLL依赖项问题。


error:Unable to load DLL 'x.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

OS: Windows 7

I have two stations, Visual Studio 2012, using .net 4.0; the other don't have VS installed On the first station with VS2012 I have a C# solution with a C++ project imported. I'm using:

    [DllImport("x.dll", CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.I4)]

On this station is working.

But when I moved on the other station (that don't have VS installed) it appear that error. If I install VS, it's working.

What are some possible reasons for this problem to occur? Any ideas on what I could be missing or how I could debug this problem?

解决方案

The most likely reason is that the machine which does not have Visual Studio installed is missing the C++ runtime that is needed by your unmanaged DLL. Install the appropriate C++ runtime from the downloadable redistributable.

Do make sure that your unmanaged DLL is linked against the release runtime and not the debug runtime. The latter cannot be redistributed.

You can debug unmanaged DLL dependency issues using tools like Dependency Walker, Process Monitor etc.

这篇关于C#无法加载DLL(模块找不到HRESULT:0x8007007E)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆