SSIS - Unable to load DLL 'clrcompression.dll': The specified module could not be found

0

I need to compress a data folder in SSIS. For that, I use a Script task which runs this script :

public void Main()
        {
            // TODO: Add your code here

            try
            {
                string zipPath = (string)Dts.Variables["User::sFolderCompressed"].Value;
                string startPath = (string)Dts.Variables["User::sFolderSource"].Value;


                ZipFile.CreateFromDirectory(startPath, zipPath);
            }
            catch (Exception objException)
            {
                Dts.TaskResult = (int)ScriptResults.Failure;
                // Log the exception
            }
            Dts.TaskResult = (int)ScriptResults.Success;
        }

The 2 variables I have set up:

enter image description here

Executing the Script Task step gives me the following error:

{System.DllNotFoundException: Unable to load DLL 'clrcompression.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at Interop.inflateInit2_(Byte* stream, Int32 windowBits, Byte* version, Int32 stream_size) at System.IO.Compression.ZipFile.Open(String archiveFileName, ZipArchiveMode mode, Encoding entryNameEncoding) at System.IO.Compression.ZipFile.DoCreateFromDirectory(String sourceDirectoryName, String destinationArchiveFileName, Nullable`1 compressionLevel, Boolean includeBaseDirectory, Encoding entryNameEncoding) at System.IO.Compression.ZipFile.CreateFromDirectory(String sourceDirectoryName, String destinationArchiveFileName) at ST_19ce97c462f844559ec30884173f5a28.ScriptMain.Main() in c:\Users\SQL\AppData\Local\Temp\3\Vsta\46892b1db29f45f2a8e1fb8c5d37a542\ScriptMain.cs:line 104}

Error message is pretty clear that I am missing a 'clrcompression.dll' file somewhere. Can I just download this DLL? and where do I copy it to?

UPDATE

Added 'Execute Process Task' and set the following:

Executable : 'powershell.exe'  
Arguments : -nologo -noprofile
    -command "Compress-Archive -Path E:\Flat Files\IT\StockAge\Stock Age Difference\MAINCHECKK807Babbage\BabbageStockAgeingPartno.csv
    -DestinationPath E:\Flat Files\IT\StockAge\Stock Age Difference\MAINCHECKK807Babbage\BabbageStockAgeingPartno.zip"

But getting error:

[Execute Process Task] Error: In Executing "powershell.exe" "-nologo -noprofile -command "Compress-Archive -Path E:\Flat Files\IT\StockAge\Stock Age Difference\MAINCHECKK807Babbage\BabbageStockAgeingPartno.csv -DestinationPath E:\Flat Files\IT\StockAge\Stock Age Difference\MAINCHECKK807Babbage\BabbageStockAgeingPartno.zip"" at "", The process exit code was "1" while the expected was "0".

UPDATE 2

Executing the script in PowerShell gives me the following error.

enter image description here

c#
variables
dll
ssis
asked on Stack Overflow Nov 16, 2020 by PKirby • edited Nov 23, 2020 by PKirby

2 Answers

1

Script tasks only have access to the DLL's that have been registered in your GAC or have been manually loaded within the script. If you want to use a script task you'll need to load the DLL for the script to be able to run

Alternatively for basic zip functionality you can use a command line tools and call it from an execute process task. If you have the latest windows server running with all the .net frameworks installed you can try the PowerShell method, else use the 7zip method

PowerShell Zip Method

Set up the the execute task so that it calls PowerShell and passes your zip instruction in the arguments

Execute Process Task

Executable = 'powershell.exe'
Arguments = Powershell -nologo -noprofile -command 'Compress-Archive -Path \"C:\SO\Test Folder\Test.txt\" -DestinationPath \"C:\SO\Test Folder\Test.zip\"'

Edit 1

If your paths have spaces then you need to escape them with backslash and double quotes

Your Arguments should be

-nologo -noprofile -command 'Compress-Archive -Path \"E:\Flat Files\IT\StockAge\Stock Age Difference\MAINCHECKK807Babbage\BabbageStockAgeingPartno.csv\" -DestinationPath \"E:\Flat Files\IT\StockAge\Stock Age Difference\MAINCHECKK807Babbage\BabbageStockAgeingPartno.zip\"'

Edit 2

To debug the command try running it in PowerShell as below, see if there are any additional information

Running the command from PowerShell

ZipFile

7Zip Method

Install 7zip 64bit on all the servers this package will be running on

You need to ensure that the install directory matches between servers or else ssis will not find the executable when deployed

Executable = C:\Program Files\7-Zip\7z.exe
Arguments = a -r "C:\SO\Test Folder\Test.zip" "C:\SO\Test Folder\Test.txt"

7zip

answered on Stack Overflow Nov 16, 2020 by Ockert • edited Nov 24, 2020 by Ockert
0

clrcompression.dll is a part of .NET Framework.

I think you need to check .NET Framework installation on your machine.

answered on Stack Overflow Nov 16, 2020 by Dmitriy Grebennikov

User contributions licensed under CC BY-SA 3.0