【问题标题】:The Binary code for the script task is not found. Please open the script in the designer and make sure it builds successfully找不到脚本任务的二进制代码。请在设计器中打开脚本并确保它构建成功
【发布时间】:2021-09-12 16:18:27
【问题描述】:

我一直在尝试为 Knight 的 MS SSIS 24 小时教练解决练习。

我在包中有一个脚本任务,它检查变量的值并显示一个消息框。除此以外没有其他组件。

当我尝试构建脚本任务代码时,它给出了错误 -

One or more errors occurred. 
Project = ST_<GUID#>. File = mscorlib

脚本任务源码如下:

        public void Main()
        {
            // TODO: Add your code here
            if ((int)Dts.Variables["User::intVar"].Value >= 10)
                Dts.Variables["User::strVar"].Value = "Big";
            else
                Dts.Variables["User.strVar"].Value = "Small";
            MessageBox.Show(Dts.Variables["User::strVar"].Value.ToString());

            Dts.TaskResult = (int)ScriptResults.Success;
            
        }

在运行包时,我收到错误:

The Binary code for the script task is not found. 
Please open the script in the designer and make sure it builds successfully.

我已经尝试了几乎所有可以在 Stack Overflow 上找到的东西:

  • Set DelayValidation = True,重启电脑,将包导入新项目。
  • 删除整个项目并重新构建。
  • 清理构建等

【问题讨论】:

  • 事实证明,我编写的所有脚本任务都遇到了同样的错误。有没有办法解决这个问题?
  • 你的 else 变量的编码不同,因为它在引号中,所以它不会编译为错误。

标签: ssis script-task


【解决方案1】:

正如 KeithL 所说,

  • 改变这个:Dts.Variables["User.strVar"].Value = "Small";
  • 对此:Dts.Variables["User::strVar"].Value = "Small";

我不确定为什么您的脚本没有编译。我还会检查错误窗格,看看是否还有其他问题,例如缺少对 System.Windows.Forms 的引用

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-05
    相关资源
    最近更新 更多