Monday, March 26, 2012

Making my containers visible design time

Hi all,

I have run into a problem! Im developing a SSIS package programmatically using C#. But when i create and add a container (foreachloop and sequence) the container is not becommming visible in design time in my intergration services designer (when i open the .dtsx package afterwards). Does anyone have a solution to this problem? It is only a problem with containers i create myself (it is working when im adding e.g. dataflow tasks to existing containers).

Sincerely

Bryan

I have not observed this when building packages programmatically. Here's a basic C# package generator which adds in a single sequence before saving to disk. Does this sequence container not appear when your run the generator?

using System;

using System.Collections.Generic;

using System.Text;

using System.Xml;

using Microsoft.SqlServer.Dts.Runtime;

namespace GeneratePackage

{

class SingleSequence

{

static string pkgName = "AtomicSequence.dtsx";

static void Main(string[] args)

{

Application a = new Application();

Package p = CreatePackage();

Console.WriteLine("Attempting to save {0} to {1}", pkgName, Environment.CurrentDirectory);

a.SaveToXml(pkgName, p, null);

Console.WriteLine("Press key to exit...");

Console.Read();

return;

}

public static Package CreatePackage()

{

Package package = new Package();

package.PackageType = DTSPackageType.DTSDesigner90;

package.CreationDate = DateTime.Now;

package.CheckpointFileName = @."AtomicSequence.xml";

package.SaveCheckpoints = true;

package.CheckpointUsage = DTSCheckpointUsage.IfExists;

FillExecutables_Package(package.Executables, package);

package.Name = @."AtomicSequence";

return package;

}

private static void FillExecutables_Package(Executables property, Package obj)

{

Sequence exec1 = (Sequence)property.Add("STOCK:SEQUENCE");

exec1.FailPackageOnFailure = true;

exec1.Name = @."SEQ Atomic";

exec1.Description = @."Sequence Container";

}

}

}

|||

Thx for the reply...

Your sample works fine, i can see the sequence in my design environment. The main difference between your project and mine is that i save directly to the package store in the SQL Server...

I will try to save my package to the disk instead of to the package store and see if that helps. Ill return when i have tested it, thx in advance :-)

Sincerely

Bryan

|||

Hi again,

Doesnt seem to work, i tried to modify my own code and its not showing up design time :-(

I better explain how i do things:

I have a partially filled package that i load from disk and "fills in the blanks" (this is done to make it generic enough to suit the different source systems i work with) i fill in a premade sequence container with a bunch of foreach loops and lots of components inside those. I then save the ssis to the packages storage and thats it! When i load it in the designer it still shows up without the loops i added programmatically visible.
After some thorough research i can see that in the XML of the package there is some kind of embedded xml in the start of the package, concerning layout (at least i think its concerning layout) and my added components are not present in that embedded xml...

Edit: BTW im doing this also with another sequence where i fill in a bunck of processing tasks, these shows up on top of each other and doesnt seem to be visually in the container, i can drag them out but not drag them inside again. It seems that its only my foreach loop that not gets visible - weird

/Bryan

|||

Yep, that's definitely layout information. You might check to just see if the containers are outside the viewable area of the package. Grab the little box on the bottom right of the design surface and see if the container shows up.

The xml at the beginning of the package is added by the designer. There is no API for managing that xml.

No comments:

Post a Comment