SQL Packager 6

Package executable cannot load zlib1.dll

 

When running a package executable created using the SQL Packager API using compression on a 64-bit version of Windows, the package may throw the following error when executed on another computer hosting a 64-bit version of Windows:

 Unable to load DLL 'zlib1.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E).

Cause / Possible causes

The problem is caused by the default 'Any CPU' configuration when the project is compiled on .NET. On a 64-bit system, this code will run as a 64-bit application. When the decompression library is linked to the package application, this is a 32-bit library, which cannot be loaded into an application that is 64-bit aligned.

How to fix

One possible solution is to output the package as a C# project rather than an executable, open it in Visual Studio 2003, open the project's properties, and change the project properties from 'Any CPU' to 'x86'. Then build the project. This will create a 32-bit version of the executable that can load the 32-bit version of Zlib1.dll.

Another possibility is to use Microsoft's Corflags.exe utility to set the package assembly's 32-bit flag in the assembly header as described here: http://msdn2.microsoft.com/en-us/library/ms164699(VS.80).aspx

SQL Packager version 6 and higher has renamed Zlib1.dll to RedGate.Compression.Zlib.dll, and this dll is set to JIT compile on 'Any CPU', so this problem will not occur when running SQL Package executables on 64-bit systems, regardless of whether they are built on a 64 or 32-bit system.

If you continue to experience problems, please contact Red Gate Support.


Didn't find what you were looking for?