简体   繁体   中英

Running an SSIS package developed in SQL Server Data Tools for Visual Studio 2013 from Visual Studio 2015

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM