Click here to Skip to main content
13,860,571 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


5 bookmarked
Posted 19 Feb 2013
Licenced CPOL

Programmatically Create and Deploy SSIS 2012 Project into Catalog Using C#

, 19 Feb 2013
Rate this:
Please Sign up or sign in to vote.
In this article, I will demonstrate the scripting of Integration Services Catalog packages using C#.


SQL Server Integration Services 2012 comes with a new API for scripting packages which is called MOM – Managed Object Model. In this article, I will demonstrate the scripting of Integration Services Catalog packages using C#.



We begin by launching Microsoft Visual Studio and create a new Integration Services Project which is located under Business Intelligence Projects category.

After you have assigned a project name, proceed to click and drag the Script Task into Control Flow pane from toolbox.

Right click the script task and click on “Edit”.

Under the Script Task Editor, change the “ScriptLanguage” to “Microsoft Visual C# 2010″.

In Project Explorer, ensure the following references are added:

  • System
  • Microsoft.SqlServer.Management.IntegrationServices
  • Microsoft.SqlServer.Management.Smo 
  • Microsoft.SqlServer.Dts.Runtime

It is possible that you might not find the Microsoft.SqlServer.Management.IntegrationServices.dll under .NET references in Visual Studio, in which case I suggest you click here for an article on referencing the missing assembly file.

Back to the code window, ensure that the following namespaces are declared:

  • using System;
  • using Microsoft.SqlServer.Management.IntegrationServices;
  • using Microsoft.SqlServer.Management.Smo;
  • using Microsoft.SqlServer.Dts.Runtime;

Then, under your main class, create an instance of SMO Server as well as integration services object as shown below:

The next part is to create an SSIS Catalog database followed by CatalogFolder, Project, then SSIS packages. It is possible, however, that you (or an administrator) might have created the SSIS Catalog. It is also possible that the CatalogFolder might have been created already. In order to address these possible scenarios, I have created a function with a set of parameters that can be called based on a particular scenario. The function is called:

  • sS_SsisObjCreate(int condition, IntegrationServices sS_Is, Catalog sS_Ct, CatalogFolder sS_Cf)
Now, add the below code in the main class, just after your declarations of SMO Server and Integration Services object.
The rest of the code relates to the function “sS_SsisObjCreate” and it looks as follows:


Voilà! Now you can open SQL Server Management Studio and connect to the Server you provided in the above and you should find your newly created packages as shown below:




This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Sifiso W Ndlovu
Technical Lead select SIFISO
South Africa South Africa
Sifiso W. Ndlovu is a certified Microsoft professional who holds a Master’s degree in IT Management from the University of Johannesburg. He specializes on a range of enterprise and consumer technologies using open source and proprietary software. He is the member of the Johannesburg SQL User Group wherein he has made several presentations on User Group Meetings and SQL Saturday sessions. He has written for a number of publications including and

You may also be interested in...


Comments and Discussions

QuestionCreate Package where it is created? Pin
harikrishna puppala19-Jun-17 21:01
memberharikrishna puppala19-Jun-17 21:01 
QuestionTips if you want to use this code in C# app rather than SSIS package. Pin
ARB7014-Apr-15 1:56
memberARB7014-Apr-15 1:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.190214.1 | Last Updated 19 Feb 2013
Article Copyright 2013 by Sifiso W Ndlovu
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid