I believe that what I want is not currently possible but thought I had better throw it out there first.
I have a scenario where I need to generate many hundreds of SSIS packages which in itself is fine, where I am falling down is I want them added to an SSIS project in VS2012 automatically.
I have gone down the route of using envDTE which is the standard (as I understand it) way to programmatically add files to projects.
Code:
EnvDTE.DTE dte2; dte2 = (EnvDTE.DTE)System.Runtime.InteropServices.Marshal. GetActiveObject("VisualStudio.DTE.11.0"); Projects projy = dte2.Solution.Projects; foreach (Project d in projy) { Console.WriteLine(d.Name.ToString()); if (d.Name == "Integration Services Project1") { foreach (ProjectItem g in d.ProjectItems) { Console.WriteLine(" " + g.Name.ToString()); } d.ProjectItems.AddFromFile(pkg); // Error Thrown here } }
I get the error "A null reference pointer was passed to the stub. (Exception from HRESULT: 0x800706F4)" I assume at this point it has something to do with SSIS projects requiring GUIDs for files which are not created as part of the AddFromFile method.
Is there any way to accomplish what I want to do without having to mess around with the sln??