我正在使用Visual Studio Community 2015开发一个.NET应用程序,其中使用了一些AForge.NET库。我已经将这些库添加到我的项目中,在调试应用程序时,这些库工作正常。但是,当我发布并在同一台计算机上安装该应用程序后,一旦到达使用AForge.NET库的应用程序部分,应用程序就会崩溃,并显示以下错误:
System.IO.FileNotFoundException: Could not load file or assembly 'AForge.Video.FFMPEG.dll' or one of its dependencies. The specified module could not be found.
Filename: 'AForge.Video.FFMPEG.dll'
on MyApp.mySecondForm..ctor(Int32 id)
on MyApp.myMainForm.myListView_DoubleClick(Object sender, EventArgs e)
on System.Windows.Forms.Control.OnDoubleClick(EventArgs e)
on System.Windows.Forms.ListView.WndProc(Message& m)
on System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
on System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
on System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
我在网上搜索了解决方法,但是到目前为止以下任何一种方法都没有奏效:
- 安装Visual Studio C++ Redistributable(认为可能是缺少依赖项)
- 使用文件系统编辑器在安装时添加库(我找不到Visual Studio中的编辑器)。
此外,我搜索了应用程序安装的文件夹,看到所有DLL文件都在那里,每个文件都在不同的文件夹中,还有一个包含所有DLL和其他文件的文件夹。
我对其他库(全局程序集缓存中的库)没有任何问题,例如MySql.Data
。
根据Chris O的建议,我使用进程监视器检查我的应用程序,它显示正在GAC中查找AForge库;由于我没有将它们添加到那里,因此无法找到它们。
我需要做什么才能配置我的应用程序,以便它可以从应用程序文件夹访问库而不是在GAC中查找它们?