本文介绍了从 Visual Studio 2015 运行在 SQL Server Data Tools for Visual Studio 2013 中开发的 SSIS 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SSIS 包在 VS 2013 中运行良好,但是当我尝试从 VS 2015 调用 .dtsx 时出现此错误:

The SSIS package executes fine from VS 2013 but when I try to call the .dtsx from VS 2015 I get this error:

要在 SQL Server 数据工具之外运行 SSIS 包,您必须安装 Integration Services 或更高版本的脚本任务."

这是我在 VS 2015 中的代码:

Here is my code in VS 2015:

我的 using 语句...

My using statements...

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/),我发现了一个与此错误相关的帖子很少,但没有帮助我解决它.知道我做错了什么吗?

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?

推荐答案

我已经安装了 SSDT 和 SSDT-BI,但是当我尝试从包括 VS 2013 在内的任何 Visual Studio 表单执行 SSIS 包时仍然收到此消息.我结束了卸载并重新安装我的 SQL Server 2014、SSDT 和 SSDT-BI 的所有内容.现在错误消失了,我可以从 VS 2013 和 VS 2015 执行 SSIS 包.

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.

这篇关于从 Visual Studio 2015 运行在 SQL Server Data Tools for Visual Studio 2013 中开发的 SSIS 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 01:00