问题
The SSIS package executes fine from VS 2013 but when I try to call the .dtsx from VS 2015 I get this error:
"To run a SSIS package outside of SQL server data tools you must install Script Task of Integration Services or higher."
Here is my code in VS 2015:
My using statements...
using System.Windows.Forms;
using Microsoft.SqlServer.Dts.Runtime;
My Code...
private void button1_Click(object sender, EventArgs e)
{
private string pkSSIS = @"C:\Work\Pathname_Ect";
string error = "";
label1.Text = "The package is executing...";
Package pkg = null;
Microsoft.SqlServer.Dts.Runtime.Application app;
DTSExecResult result;
try
{
app = new Microsoft.SqlServer.Dts.Runtime.Application();
pkg = app.LoadPackage(pkSSIS, null);
result = pkg.Execute();
if (result == Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure)
{
foreach (Microsoft.SqlServer.Dts.Runtime.DtsError dt_error in pkg.Errors)
{
error += dt_error.Description.ToString();
}
label1.Text = "Error Not Exception: " + error;
}
if (result == Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success)
{
label1.Text = "The package executed successfully";
}
}
catch (Exception ex)
{
label1.Text = "Exception: " + ex.Message;
}
}
Config File...
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
I was following a tutorial (https://technologyinsightscoffee.wordpress.com/2015/10/25/how-to-call-a-ssis-package-from-net-application/) and I've found a few posts relating to this error but nothing that helped resolve it for me. Any idea what I'm doing wrong?
回答1:
I had SSDT and SSDT-BI installed but was still getting this message when I tried to execute an SSIS package from any Visual Studio form including VS 2013. I ended up uninstalling and reinstalling everything for my SQL Server 2014, SSDT, and SSDT-BI. The error is now gone and I can execute SSIS packages from VS 2013 and VS 2015.
来源:https://stackoverflow.com/questions/37726801/running-an-ssis-package-developed-in-sql-server-data-tools-for-visual-studio-201