This documentation is archived and is not being maintained.

Application.LoadPackage Method (String, IDTSEvents, Boolean)

Loads a Package from the file system, and specifies the threading model.

Namespace: Microsoft.SqlServer.Dts.Runtime
Assembly: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

public Package LoadPackage (
	string fileName,
	IDTSEvents events,
	bool loadNeutral
public Package LoadPackage (
	String fileName, 
	IDTSEvents events, 
	boolean loadNeutral
public function LoadPackage (
	fileName : String, 
	events : IDTSEvents, 
	loadNeutral : boolean
) : Package



The name of the file that contains the package to load.


An IDTSEvents interface.


A Boolean that indicates whether to load the package as neutral threaded. If false, loads the package as apartment threaded.

Return Value

The package that was loaded.

The following code example loads a package from the file system, setting the loadNeutral flag to false, and then returns several properties for the package.

class ApplicationTests
        static void Main(string[] args)
            // The variable pkg points to the location of the
            // ExecuteProcess package sample installed with
            // the SSIS samples.
            string pkg = @"C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";

            Application app = new Application();
            Package p = app.LoadPackage(pkg, null, false);
           // Now that the package is loaded, we can query on
           // its properties.
            int n = p.Configurations.Count;
            DtsProperty  p2 = p.Properties["VersionGUID"];
            DTSProtectionLevel pl = p.ProtectionLevel;

            Console.WriteLine("Number of configurations = " + n);
            Console.WriteLine("VersionGUID = " + p2);
            Console.WriteLine("ProtectionLevel = " + pl);

Sample Output:

Number of configurations = 0

VersionGUID = Microsoft.SqlServer.Dts.Runtime.DtsProperty

ProtectionLevel = EncryptSensitiveWithUserKey

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms