-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.DllNotFoundException: 'Unable to load DLL 'libvips-42.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)' #136
Comments
I'm create console app for .NET 4.6.1 namespace NetVipsTest
{
internal class Program
{
private static void Main(string[] args)
{
if (ModuleInitializer.VipsInitialized)
{
Console.WriteLine($"Inited libvips {NetVips.NetVips.Version(0)}.{NetVips.NetVips.Version(1)}.{NetVips.NetVips.Version(2)}");
}
else
{
Console.WriteLine(ModuleInitializer.Exception.Message);
}
Console.ReadLine();
}
}
} and it's works fine. All required dlls copied into destination directory. |
Somehow the `<Link>` XML-element in the .targets file will no longer default to `%(Filename)%(Extension)` when the `LibvipsOutputBase` property is not set.
I could reproduce this when building with .NET Framework v4.5 and v4.6.1. It looks like this
This prevents the native DLL files from being copied to the output directory when building with .NET Framework. On .NET Core, this is not needed at all, so that should work fine, as you've noticed. The strange thing about this is that it did work in the past, so I think a recent MSBuild or NuGet upgrade broke this. FWIW, I couldn't reproduce this using this example project file (which should do the same thing as the specific ConsoleApp1.csproj<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<!-- <LibvipsOutputBase>x64</LibvipsOutputBase> -->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NetVips.Native.win-x64" Version="8.11.3" GeneratePathProperty="true" IncludeAssets="none" />
</ItemGroup>
<ItemGroup>
<None Include="$(PkgNetVips_Native_win-x64)\runtimes\win-x64\native\*">
<Link Condition="'$(LibvipsOutputBase)' != ''">$(LibvipsOutputBase)\%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project> Fortunately, there's a way to workaround this by setting <PropertyGroup>
<LibvipsOutputBase>.</LibvipsOutputBase>
</PropertyGroup> Commit 9fba9cc should also fix this. If you want to test this, you can use the nightly version of NetVips.Native. Add the <packageSources>
<add key="netvips-nightly" value="https://ci.appveyor.com/nuget/net-vips" />
</packageSources> And use NetVips.Native v8.11.3 from there (make sure you've cleared your NuGet cache, since it has the same version number). I'll make a new release soon. |
@kleisauke thank you for fast reply and comprehensive instructions on how to fix this. I will try this on Monday and will report back. Many thanks. |
NetVips.Native v8.11.3.1 is now available with this fix included. Thanks for reporting this! |
Hi,
I could use some help setting up Net-Vips on Windows (Visual Studio) for .Net Framework 4.6.1.
I have tried Net-Vips before with .NET 5 on Linux and it worked flawlesly.
When I install
NetVips 2.0.1
(.NET bindings for libvips) and thenNetVips.Native 8.11.3
from NuGet and run my test application it throws:System.DllNotFoundException: 'Unable to load DLL 'libvips-42.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)'
I have tried to install the NuGet packages in various orders, also to try install the x86 and x64 separately but nothing helped.
I'd appreciate some advice on making this work. Thanks.
The text was updated successfully, but these errors were encountered: