Unable to find an entry point named 'Environment_SetEnv' in DLL 'Magick.NET-Q8-x64.Native.dll'

十年热恋 提交于 2019-12-23 10:04:50

问题


Upgraded to latest ImageMagick / Magick.NET (7.0.2.901), and it built and ran fine locally, but explodes on the server with this error.

Unable to find an entry point named 'Environment_SetEnv' in DLL 'Magick.NET-Q8-x64.Native.dll'.

Seems to be a new issue. Judging by the change desc here:

https://magick.codeplex.com/discussions/650746

The VC Runtimes are no longer required, so installing them wouldn't be the issue - and, I've installed 2008, 2012 and 2015 VC runtimes for prior versions of the library, which worked fine.

Windows Server 2008 64-bit, 64-bit .Net 4 in IIS.

Current workaround is to roll back to 7.0.0.22, which runs without error.

Install-Package Magick.NET-Q8-AnyCPU -Version 7.0.0.22


回答1:


I had this issue a couple months back and eventually found two separate causes:

  1. AnyCPU Conflict with Previous Versions

    Problem: Magick.NET caches the native library in a temp directory unless it already exists (Relevant source code). Since I had previously tested with the Q8-x64 version (which doesn't test for CPU architecture), the Magick.NET-Q8-x64.Native.dll already existed and was not overwritten.

    Resolution: Delete the native library's temp directory. On my version of Windows, it was located at %TEMP%\Magick.NET.{TargetFramework}.{MagickNETVersion}. The Q8-AnyCPU version then extracted a new native library with the Environment_SetEnv method.

  2. Lack of Permissions in Cache Directory

    Problem: The native library was cached in a directory with restricted permissions for executing code.

    Resolution: Change the cache directory's location. My solution is the following code.

    #if DEBUG
    private static bool MagickCacheDirectoryIsSet = false;
    
    public DefaultConstructor()
    {
        if (!MagickCacheDirectoryIsSet)
        {
            ImageMagick.MagickAnyCPU.CacheDirectory = @"path\to\more\permissive\directory";
            MagickCacheDirectoryIsSet = true;
        }
    }
    #endif
    



回答2:


Had the same issue, deleting the all magick dlls from the bin folder and reinstall solved it.




回答3:


Follow these steps:

  1. Go to NuGet package manager for the solution (not the project)

  2. Uninstall any previous versions of Magick.net

  3. Install new version of Magick.net to desired projects

  4. Go to the bin folder of the main project and delete any magick.net file

  5. Run your solution

I successfully tested this method on VS2017 and Magick.net 7.6.1 (previous installation was 7.4.4)



来源:https://stackoverflow.com/questions/39127441/unable-to-find-an-entry-point-named-environment-setenv-in-dll-magick-net-q8-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!