You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

通过DTExec批处理执行SSIS包失败:Script Task加载错误求助

SSIS包通过DTExec执行失败(Script Task加载错误)

问题背景

我有一个SSIS包,在Foreach Loop容器中包含Script Task、Execute SQL Task和File System Task。该包在Visual Studio中可正常执行,但通过批处理文件调用DTExec.exe执行时出现错误。移除Script Task和File System Task后,包可正常执行。

环境信息

  • 使用SQL Express 2016
  • 批处理文件代码:
"C:\Program Files\Microsoft SQL Server\160\DTS\Binn\DTExec.exe" /F "C:\Users\orsal\OneDrive\Desktop\App\Software\ETL\Inbound\SSIS Packages\LoadOdds\Integration Services Project1\Package.dtsx" > log.txt

错误日志

Microsoft (R) SQL Server Execute Package Utility
Version 16.0.1000.6 for 64-bit
Copyright (C) 2022 Microsoft. All rights reserved.

Started:  3:06:00 PM
Error: 2024-05-10 15:06:00.31
   Code: 0xC001F02A
   Source: Foreach Loop Container 
   Description: Cannot create a task from XML for task "Script Task", type "Microsoft.ScriptTask" due to error 0x80070057 "The parameter is incorrect.".
End Error
Error: 2024-05-10 15:06:00.31
   Code: 0xC0010018
   Source: Script Task 
   Description: Failed to load task "Script Task", type "". The contact information for this task is "".
End Error
Error: 2024-05-10 15:06:00.32
   Code: 0xC0010026
   Source: Script Task 
   Description: The task has failed to load. The contact information for this task is "".
End Error
Error: 2024-05-10 15:06:00.32
   Code: 0xC0024107
   Source: Script Task 
   Description: There were errors during task validation.
End Error
Error: 2024-05-10 15:06:00.32
   Code: 0xC0010025
   Source: Package 
   Description: The package cannot execute because it contains tasks that failed to load.
End Error
DTExec: The package execution returned DTSER_FAILURE (1).
Started:  3:06:00 PM
Finished: 3:06:00 PM
Elapsed:  0.282 seconds

原因分析及解决方案

1. DTExec版本与SQL Server版本不匹配

你使用的DTExec是16.0版本(对应SQL Server 2022),但运行环境是SQL Express 2016(对应版本13.0)。SSIS对版本兼容性要求严格,高版本DTExec加载低版本包的Script Task时,会触发类型加载错误(错误码0xC001F02A)。

解决方法:使用SQL Server 2016对应的DTExec,路径为:

"C:\Program Files\Microsoft SQL Server\130\DTS\Binn\DTExec.exe" /F "你的包本地路径" > log.txt

2. OneDrive路径的权限或同步问题

包存储在OneDrive目录下,可能存在文件同步锁定、虚拟路径解析异常或权限限制,导致DTExec无法正确读取包中的Script Task配置。

解决方法:将SSIS包复制到本地非同步目录(如C:\SSIS\Packages\Package.dtsx),修改批处理文件中的路径后重新执行。

3. 32位/64位运行环境不兼容

Visual Studio默认使用32位SSIS运行时调试,而你调用的是64位DTExec。如果Script Task依赖32位组件(如特定第三方库),64位环境下无法加载任务。

解决方法:尝试使用32位版本的DTExec(对应SQL 2016):

"C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\DTExec.exe" /F "你的包路径" > log.txt

4. SQL Express未安装SSIS组件

SQL Server Express默认不包含Integration Services组件,若未手动安装SSIS,DTExec无法加载Script Task等SSIS核心任务。

解决方法:检查SQL Server 2016 Express是否已安装SSIS组件,若未安装,重新运行安装程序添加SSIS功能。

5. .NET Framework版本不匹配

Script Task在Visual Studio中开发时使用的.NET Framework版本,与DTExec运行环境中的.NET版本不一致,导致脚本无法加载。

解决方法:确认SQL Server 2016支持的.NET版本(.NET Framework 4.0/4.5),修改Script Task的目标框架版本为对应版本后重新部署包。


内容的提问来源于stack exchange,提问作者Kevin O

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 05:38:14