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

 

Share This:

  [email protected]