In a SSIS package, I have a simple script checking if the file exists. If it doesn't then the process flow should stop.
The script is correctly returning the file exist statement is false
And based on the current precedence constraint, it should proceed only if the script returns value as true
Here is the File exist flag for reference
However, the package continues and then fails. I do not understand what I missing here or what I set up incorrectly.
EDIT: Adding the actual script
public void Main()
{
string targetfile = Dts.Variables["User::FilePathLenovo"].Value.ToString();
try
{
if (File.Exists(targetfile))
{
Dts.Variables["User::FileExists"].Value = true;
}
else
{
Dts.Variables["User::FileExists"].Value = false;
}
Dts.TaskResult = (int)ScriptResults.Success;
}
catch (Exception Ex)
{
Dts.TaskResult = (int)ScriptResults.Failure;
}
MessageBox.Show("File.Exists(targetfile): " + File.Exists(targetfile));
}