I am trying to run an SSIS package from a simple console app. Unfortunately I am stuck on some errors`
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SqlServer.Management.IntegrationServices;
using System.Data.SqlClient;
namespace SSIStutorial
{
class Program
{
static void Main(string[] args)
{
// Variables
string targetServerName = "localhost";
string folderName = "Projects";
string projectName = "SSIS Tutorial";
string packageName = "Lesson 1.dtsx";
// Create a connection to the server
string sqlConnectionString = "Data Source = cgol1793109; Initial Catalog = TEST; Integrated Security=True;";
SqlConnection sqlConnection = new SqlConnection(sqlConnectionString);
// Create the Integration Services object
IntegrationServices integrationServices = new IntegrationServices(sqlConnection);
// Get the Integration Services catalog
Catalog catalog = integrationServices.Catalogs["SSISDB"];
// Get the folder
CatalogFolder folder = catalog.Folders[folderName];
// Get the project
ProjectInfo project = folder.Projects[projectName];
// Get the package
PackageInfo package = project.Packages[packageName];
// Run the package
package.Execute(false, null);
}
}
}
I get the following while instantiating the IntegrationServices object of the type IntegrationServices. I get the following error.
System.MissingMethodException HResult=0x80131513 Message=Method not found: 'Void Microsoft.SqlServer.Management.Sdk.Sfc.SqlStoreConnection..ctor(System.Data.SqlClient.SqlConnection)'. Source=Microsoft.SqlServer.Management.IntegrationServices StackTrace: at Microsoft.SqlServer.Management.IntegrationServices.IntegrationServices..ctor(SqlConnection sqlConnection) at SSIStutorial.Program.Main(String[] args) in C:\Users\kokoro\source\repos\SSIStutorial\Program.cs:line 26