Last Updated on 2018-11-14.
[:en]By default, you may install Accord.NET (powerful imagin/video/audio/machine learning framework) via NuGET and everything works fine on your VS development station.
But after deploying your project via ClickOnce, you get a FileNotFoundException (e.g. Accord.Video.FFMPEG.x64.dll or a dependency is missing), even if this file does exist in the ClickOnce folder (somewhere under %localappdata%\apps).
Solution
You have to add several additional DLL files to your VS project:
- swresample-2.dll
- swscale-4.dll
- avformat-57.dll
- avutil-55.dll
- avcodec-57.dll
- avdevice-57.dll
- avfilter-6.dll
- postproc-54.dll
Just use the files e.g. from your “packages” (NuGET) project’s subfolder.
Unfortunately, you cannot add a project reference of those files (ends with an error); you have to include them in your project.
Important: Set the property “Copy to output directory” for every file.
Then re-publish your project and it should work.
Background
For unknown reason, the ClickOnce publishing procedure does not include those files into the final package, even if they exist e.g. in the local Debug folder.
To find the right files, a tool called Dependency Walker is very useful. You just have to load the errornous DLL file, ignore MS’ default DLL links and you might find your DLL which is causing problems.
Just a guess, but the error would maybe also not appear if you choose x86 or x64 in your project (not “Any CPU”), and of course choose the right FFMPEG NuGET package. However, in my case I needed the “Any CPU” option to publish the package to all users, where only the x64 users really needed the video/FFMPEG feature. At least the content of the file packages/Accord.Video.FFMPEG/Accord.Video.FFMPEG.x64.targets points in this direction.
References:
https://stackoverflow.com/questions/51486105/could-not-load-file-or-assembly-accord-video-ffmpeg-x64-dll-or-one-of-its-depe
https://github.com/accord-net/framework/issues/1489
[:]
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’