Thomas van Bilsen
Thomas van Bilsen

Reputation: 71

How to create a SSIS 2012 Project using EzAPI?

I'm trying to create a SSIS 2012 project using EzAPI. However I'm unable to open my project file in Visual Studio after I've saved it to disk.

The code im using to create a simple project containing one package is the following:

EzProject MyProject = new EzProject();
EzPackage MyPackage = new EzPackage();
MyPackage.Name = "MyPackage";

MyProject.AddPackage(MyPackage);

MyPackage.SaveToFile("C:/Temp/MyPackage.dtsx");
MyProject.SaveAs("C:/Temp/MyProject.dtproj");

As expected my C:/Temp folder contains the package and the .dtproj file. However I'm unable to open the dtproj file in Visual Studio. The error I reveive when I try is: "Exception from HRESULT x80041FEB"

Also when I open the .dtproj file in notepad it does not contain XML like a .dtproj file should. It contains some gibberish with alot of special characters (for example: eQMs‚0¼wÆÿÀä$| )

Í'm using the latest version of EzAPI which can be downloaded here: http://sqlsrvintegrationsrv.codeplex.com/releases/view/82369

What am I doing wrong?

Upvotes: 4

Views: 1120

Answers (1)

Thomas van Bilsen
Thomas van Bilsen

Reputation: 71

I've finally figured out what was going on.

EzProject.SaveAs does not create a .dtproj file but an .ispac file. Which contains all the project files and can be deployed to SQL Server.

When you open the .ispac file with, for example, WinZip you will see that it contains all the packages and other project metadata.

The code below will create a project containing one package and saves it to an .ispac file.

        EzProject MyProject = new EzProject();
        MyProject.Name = "MyProject";
        EzPackage MyPackage = new EzPackage();
        MyPackage.Name = "MyPackage";
        MyProject.AddProjectParameter("MyParameter", TypeCode.Boolean);
        MyProject.AddPackage(MyPackage);
        MyProject.SaveAs("C:/MyProject.ispac");
        MyProject.CloseProject();

Upvotes: 3

Related Questions