4

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?

  • I can concur with your findings. One thing I've noticed comparing an SSDT generate .dtproj file with the one generated from EzAPI is that the former is UTF-8 encoded while the EzAPI version is ANSI encoding. I wonder if that is the issue. I tried the overload methods for the Project.SaveAs that take a Stream but couldn't make it work. – billinkc Feb 15 '13 at 16:57
  • @siva Great minds think alike. I had just concluded that using the straight API was yielding the same results. https://gist.github.com/anonymous/4961846 – billinkc Feb 15 '13 at 17:18
  • The only other thought I had is to try and ask the question on the EzAPI project site. I haven't heard much out of the team on social media sites so perhaps they are neck deep in getting a deploy ready but that's about the only other forum I can think of to raise the question. You could cheat a bit and create an empty project file from SSDT and then alter the XML using a normal XML library. It lacks elegance and for anything but a straight package, it looks unpleasant. – billinkc Feb 15 '13 at 17:39
  • 3
    An interesting observation, I used Project.OpenProject to open a "valid for SSDT" project file and it failed with a `File contains corrupted data` error message. I wonder if they've done something weird like the Project class we are all focusing on is for some internal use and there's some interface we don't see/know about that is used by SSDT. – billinkc Feb 15 '13 at 17:47
  • Thanks for all the comments. After reading ArthurZ's post on msdn I also tried to use the OpenProject method on a valid .dtproj file and ended up with the same exception:"The data format is invalid with error 'File contains corrupted data.'.". I have to agree with Siva that it looks more like an SSIS issue! – Thomas van Bilsen Feb 15 '13 at 17:59

1 Answers1

3

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();