This issue seems very similar to #2 and possibly related to #3.
When I build a new project explicitly targeting x86 or x64 directly, MediaInfo.dll and its related dependencies are all copied to the general output directory (e.g. bin\x86\Debug\MediaInfo.dll), but when I build the project with the Any CPU platform selected, MediaInfo.dll and related dependencies are copied into a subfolder for each architecture (e.g. bin\Debug\x86\MediaInfo.dll).
We require our project to target x86 specifically for other reasons, so the only workaround I can see to address this (without forking this project) is to add a post build step to move those five MediaInfo files (libcrypto-1_1.dll, libcurl.dll, libssh2.dll, libssl-1_1.dll and MediaInfo.dll) into a new x86 subdirectory.
I've been able to reproduce this fairly trivially in a standalone project as follows:
Create a new console project in Visual Studio
Add MediaInfo.Wrapper as a NuGet dependency for your project
Add an example video to the project (mine is named testvideo-5s.mp4) and set it to copy to the output directory
In Program.cs, add the following code:
var info = new MediaInfoWrapper("testvideo-5s.mp4");
if (info.MediaInfoNotloaded)
{
Console.WriteLine("Failed to load");
}
else
{
Console.WriteLine("Loaded successfully");
}
Set the project's configuration to build for the x86 platform only.
Build and run, and observe "Failed to load"
Set the project's configuration to build for Any CPU
This issue seems very similar to #2 and possibly related to #3.
When I build a new project explicitly targeting x86 or x64 directly,
MediaInfo.dll
and its related dependencies are all copied to the general output directory (e.g.bin\x86\Debug\MediaInfo.dll
), but when I build the project with the Any CPU platform selected,MediaInfo.dll
and related dependencies are copied into a subfolder for each architecture (e.g.bin\Debug\x86\MediaInfo.dll
).MediaInfo.Wrapper.dll
always expects to findMediaInfo.dll
in a subdirectory which causes the Any CPU version to work and the x86-specific version to fail (withMediaInfoNotloaded
set totrue
).We require our project to target x86 specifically for other reasons, so the only workaround I can see to address this (without forking this project) is to add a post build step to move those five MediaInfo files (
libcrypto-1_1.dll
,libcurl.dll
,libssh2.dll
,libssl-1_1.dll
andMediaInfo.dll
) into a newx86
subdirectory.I've been able to reproduce this fairly trivially in a standalone project as follows:
MediaInfo.Wrapper
as a NuGet dependency for your projecttestvideo-5s.mp4
) and set it to copy to the output directoryIn
Program.cs
, add the following code: