SSIS包在VS 2013中运行良好,但是当我尝试从VS 2015调用.dtsx时,我收到此错误:
“要在SQL Server数据工具之外运行SSIS包,必须安装Integration Services或更高版本的脚本任务。”
这是我在VS 2015中的代码:
我的使用陈述......
using System.Windows.Forms;
using Microsoft.SqlServer.Dts.Runtime;
我的代码......
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;
}
}
配置文件...
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
我正在关注一个教程(https://technologyinsightscoffee.wordpress.com/2015/10/25/how-to-call-a-ssis-package-from-net-application/),我发现了一些与此错误有关的帖子,但没有任何帮助我解决它的问题。知道我做错了吗?
答案 0 :(得分:0)
我安装了SSDT和SSDT-BI但当我尝试从包括VS 2013在内的任何Visual Studio表单执行SSIS包时仍然收到此消息。我最终卸载并重新安装了我的SQL Server 2014,SSDT和SSDT-BI。错误现在已经消失,我可以从VS 2013和VS 2015执行SSIS包。