Search code examples
visual-studiodllffmpegclickoncevideo-processing

Could not load file or assembly 'Accord.Video.FFMPEG.dll' or one of its dependencies on Click Once Install


My application that has 'Accord.Video.FFMPEG.dll' and supporting DLL's works properly in the development environment. When I publish and try to Click Once install I receive the following message: Could not load file or assembly 'Accord.Video.FFMPEG.dll' or one of its dependencies. The specified module could not be found. File name: 'Accord.Video.FFMPEG.dll'

As suggested in other posts, I copied the following DLL's into my Resources folder in my Visual Studio Project and specified to 'always copy to installation folder'. I see them in the Install Folder inside the folder C:\JPGManagerPublish\Application f Files\JPGManager_3_0_0_179\Resources

avcodec-57.dll avdevice-57.dll avfilter-6.dll avformat-6.dll avformat-57.dll avutil-55.dll postproc-54.dll swresample-2.dll swscale-4.dll

These show up in the application install folder as avcodec.57.dll.deploy, etc.

I install the application with Setup and I when I execute the function that utilizes Accord.Video.FFMPEG.dll I get the error message : 'Accord.Video.FFMPEG.dll' or one of its dependencies. The specified module could not be found. File name: 'Accord.Video.FFMPEG.dll' enter image description here


Solution

  • You can try to solve it with the following steps:

    1. Use the latest package currently available in NuGet.

    2. Make sure your application is running in 64-bit mode (check Environment.Is64BitProcess and Environment.Is64BitOperatingSystem), if so, download and install Accord.Video.FFMPEG.x64 from NuGet only (do not install Accord.Video. FFMPEG). enter image description here

    3. If you still face the problem, please check the value of Directory.GetCurrentDirectory() and make sure the dll of FFmpeg is contained in this folder.

    4. Try adjusting your PATH variable to include the directory where these .dlls are located (usually in the Bin folder).

      string oldPath = Environment.GetEnvironmentVariable("Path"); Environment.SetEnvironmentVariable("Path", pathToFFmpegDlls + ";" + oldPath);