SSIS - 无法加载 DLL 'clrcompression.dll': 找不到指定的模块
SSIS - Unable to load DLL 'clrcompression.dll': The specified module could not be found
我需要在 SSIS 中压缩一个数据文件夹。
为此,我使用运行此脚本的脚本任务:
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;
}
我设置的2个变量:
执行脚本任务步骤时出现以下错误:
{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\Vsta892b1db29f45f2a8e1fb8c5d37a542\ScriptMain.cs:line
104}
错误消息很清楚,我在某处丢失了一个 'clrcompression.dll' 文件。
我可以只下载这个 DLL 吗?我应该将它复制到哪里?
更新
添加了 'Execute Process Task' 并设置了以下内容:
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"
但是出现错误:
[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".
更新 2
在 PowerShell 中执行脚本时出现以下错误。
clrcompression.dll
是 .NET Framework 的一部分。
我认为您需要检查计算机上的 .NET Framework 安装。
脚本任务只能访问已在脚本中 GAC or have been manually loaded 中注册的 DLL。如果你想使用脚本任务,你需要加载脚本的 DLL 才能 运行
或者,对于基本的 zip 功能,您可以使用命令行工具并从执行进程任务中调用它。如果您有最新的 windows 服务器 运行 安装了所有 .net 框架,您可以尝试 PowerShell 方法,否则使用 7zip 方法
PowerShell 压缩方法
设置执行任务,以便它调用 PowerShell 并在参数中传递您的 zip 指令
Executable = 'powershell.exe'
Arguments = Powershell -nologo -noprofile -command 'Compress-Archive -Path \"C:\SO\Test Folder\Test.txt\" -DestinationPath \"C:\SO\Test Folder\Test.zip\"'
编辑 1
如果你的路径有空格,那么你需要用反斜杠和双引号将它们转义
你的论点应该是
-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\"'
编辑 2
要调试该命令,请尝试 运行按如下所示在 PowerShell 中对其进行调试,查看是否有任何其他信息
7Zip 方法
在所有服务器上安装 7zip 64 位,此软件包将运行安装在
您需要确保服务器之间的安装目录匹配,否则 ssis 在部署时将找不到可执行文件
Executable = C:\Program Files-Zipz.exe
Arguments = a -r "C:\SO\Test Folder\Test.zip" "C:\SO\Test Folder\Test.txt"
我需要在 SSIS 中压缩一个数据文件夹。 为此,我使用运行此脚本的脚本任务:
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;
}
我设置的2个变量:
执行脚本任务步骤时出现以下错误:
{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\Vsta892b1db29f45f2a8e1fb8c5d37a542\ScriptMain.cs:line 104}
错误消息很清楚,我在某处丢失了一个 'clrcompression.dll' 文件。 我可以只下载这个 DLL 吗?我应该将它复制到哪里?
更新
添加了 'Execute Process Task' 并设置了以下内容:
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"
但是出现错误:
[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".
更新 2
在 PowerShell 中执行脚本时出现以下错误。
clrcompression.dll 是 .NET Framework 的一部分。
我认为您需要检查计算机上的 .NET Framework 安装。
脚本任务只能访问已在脚本中 GAC or have been manually loaded 中注册的 DLL。如果你想使用脚本任务,你需要加载脚本的 DLL 才能 运行
或者,对于基本的 zip 功能,您可以使用命令行工具并从执行进程任务中调用它。如果您有最新的 windows 服务器 运行 安装了所有 .net 框架,您可以尝试 PowerShell 方法,否则使用 7zip 方法
PowerShell 压缩方法
设置执行任务,以便它调用 PowerShell 并在参数中传递您的 zip 指令
Executable = 'powershell.exe'
Arguments = Powershell -nologo -noprofile -command 'Compress-Archive -Path \"C:\SO\Test Folder\Test.txt\" -DestinationPath \"C:\SO\Test Folder\Test.zip\"'
编辑 1
如果你的路径有空格,那么你需要用反斜杠和双引号将它们转义
你的论点应该是
-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\"'
编辑 2
要调试该命令,请尝试 运行按如下所示在 PowerShell 中对其进行调试,查看是否有任何其他信息
7Zip 方法
在所有服务器上安装 7zip 64 位,此软件包将运行安装在
您需要确保服务器之间的安装目录匹配,否则 ssis 在部署时将找不到可执行文件
Executable = C:\Program Files-Zipz.exe
Arguments = a -r "C:\SO\Test Folder\Test.zip" "C:\SO\Test Folder\Test.txt"