首页 > 解决方案 > System.IO.FileNotFoundException: '无法加载文件或程序集

问题描述

我是 C# 的初学者,试图在项目中添加一个 DLL,但在运行项目时出现以下错误:

System.IO.FileNotFoundException: 'Could not load file or assembly 'Interop.TrueConf_CallXLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.'

我试图在任何 CPU、X64 和 x86 上运行它,但它几乎是相同的错误。你能帮我修一下吗?

以下是完整的例外:

    Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Interop.TrueConf_CallXLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
   at AxTrueConf_CallXLib.AxTrueConfCallX.AttachInterfaces()
   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.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.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)
The program '[20208] TruconfCall.exe' has exited with code 0 (0x0).

标签: c#.netdll

解决方案


错误说

System.IO.FileNotFoundException:'无法加载文件或程序集'Interop.TrueConf_CallXLib,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null'或其依赖项之一。该系统找不到指定的文件。'

所以我怀疑必须有更多的dll依赖于当前的dll。因此,如果 SDK 将库安装到 GAC,请先安装 TrueConf SDK 并从程序集中引用它,而不是使用浏览选项添加 dll。


推荐阅读