Failed to load or complete the assembly or one of its dependencies

I use the Aforge.net framework for working with image processing. I will add "AForge.Video.FFMPEG.dll" as a link to my project. I am using VS2012 and a 32 bit build target. When buiding I get

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: 

my code for this exception occurs

  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()); } } } 
+8
c # ffmpeg filenotfoundexception aforge
source share
8 answers

You need to copy the DLL from "Externals \ ffmpeg \ bin" to your AForge.Video.FFMPEG.dll location and maybe you need to install Microsoft Visual C ++ Redistributable.

+9
source share

I know him a little late, but I hope my answer helps someone. I had this problem and it was a little hard for me. Here's how it worked for me:

  • Project -> Add an existing item (go to the DLL from "External files \ ffmpeg \ bin" as mentioned in other answers)
  • Make sure you show all types from the drop down list of file types
  • Select all the DLLs and click the "Add" button. Select a link.
  • DLLs should be shown on your design decision, select all of them
  • Edit the Build Action property and make it NativeBinary
  • Edit the directory "Copy to output directory" and make it "Copy always"

What is it. This worked for me, I published my application and worked on a Windows tablet. Greetings

+3
source share

try it

verify that the goal of the project is x86, because the build will not work in 64. then check if the FFMPEG DLL is in the same directory of your application.

+2
source share

try this tool: Avoiding dependencies This saves my time several times.

EDIT: Sorry, I saw the last comment too late.

0
source share

I solved the problem by rebuilding the project in Release mode (I am using Visual studio 2013)

0
source share

I tried every recommended solution, and none of them worked for me, when I used dependencywalker, I noticed that there were no files in the library (version 2.2.5). So I downloaded the previous version 2.2.4 and it works great for me.

0
source share

To fix this error, I am changing the target processor to X86 to match the architecture of the referenced Chilkat-dll component. For other dlls, you must select the correct target processor for your project that matches the architecture of the dll component. The error will be resolved. Right-click on the project name> Property> Compile> Target CPU โ†’, you will be taken to the Target CPU.

0
source share

This worked for me:

  • Add useLegacyV2RuntimeActivationPolicy="true" in App.Config
  • Link the two AForge.Video.dll - AForge.Video.dll , AForge.Video.FFMPEG.dll
  • Copy the output folder \AForge.NET Framework-2.2.5\Externals\ffmpeg\bin *.dlls
0
source share

All Articles