无法加载或组装或其依赖项之一

Pra*_*ana 10 c# ffmpeg filenotfoundexception aforge

我正在使用Aforge.net框架工作进行图像处理工作.我添加'AForge.Video.FFMPEG.dll'作为我的项目的参考.我正在使用VS2012和32位构建目标.当Buiding我得到

 System.IO.FileNotFoundException was unhandled
  HResult=-2147024770
  Message=Could not load file or assembly 'AForge.Video.FFMPEG.dll' or one of its dependencies. The specified module could not be found.
  Source=VideoReadere
  FileName=AForge.Video.FFMPEG.dll
  FusionLog=""
  StackTrace:
       at VideoReadere.Form1..ctor()
       at VideoReadere.Program.Main() in c:\Users\Prabad\Documents\Visual Studio 2012\Projects\VideoReadere\VideoReadere\Program.cs:line 19
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
Run Code Online (Sandbox Code Playgroud)

我的代码是发生异常

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace VideoReadere
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
//here below line give exception
            Application.Run(new Form1());
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

skm*_*skm 11

您需要将DLL从"Externals\ffmpeg\bin"复制到您的AForge.Video.FFMPEG.dll位置,并且您可能需要安装Microsoft Visual C++ Redistributable.

  • 还需要替换app.config中的如下标签 &lt;startup useLegacyV2RuntimeActivationPolicy="true"&gt; &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/&gt; &lt;requiredRuntime version="v4.0.20506 " /&gt; &lt;/启动&gt; (2认同)