Hey Guys, long time lurker; first time poster.
I ran into this same error message today when trying to run my SSIS pkg via a MSSQL 2008R2 Job and could only finds pieces and bits of a solution online. I utilized a file check Script Task function in my SSIS pkg that was bringing up this error due to it prompting a messagebox. I came up with the below solution:
Step1: In SSIS, double click on your Script Task to bring up the Script Task Editor.
Step2: Click on the "Edit Script..." box on the lower right hand corner.
Step3: Remove the MessageBox.Show commands from the script shown here:
public void Main()
{
// TODO: Add your code here
String Filepath=Dts.Variables["User::FolderPath"].Value.ToString()+Dts.Variables["User::FileName"].Value.ToString();
if (
File.Exists(Filepath))
{
Dts.Variables["User::FileExistsFlag"].Value = 1;
}
MessageBox.Show(Filepath); //Show the folder path with the File Name
MessageBox.Show(Dts.Variables["User::FileExistsFlag"].Value.ToString()); //Show the flag value, 1 for exists and 0 for not exists
Dts.TaskResult = (int)ScriptResults.Success;
}
}
}
So the final product code looks like so:
public void Main()
{
// TODO: Add your code here
String Filepath=Dts.Variables["User::FolderPath"].Value.ToString()+Dts.Variables["User::FileName2"].Value.ToString();
if (
File.Exists(Filepath))
{
Dts.Variables["User::FileExistsFlag"].Value = 1;
}
Dts.TaskResult = (int)ScriptResults.Success;
}
}
}
Removing this allows your SQL job to call the SSIS package and execute it properly, maintaining your logic but removing the messageboxes that cause the aforementioned error.
Thanks,
-Caleb