Application.SaveToXml(String, Package, IDTSEvents) Método

Definição

Salva a definição XML de um pacote em um arquivo.

public:
 void SaveToXml(System::String ^ fileName, Microsoft::SqlServer::Dts::Runtime::Package ^ package, Microsoft::SqlServer::Dts::Runtime::IDTSEvents ^ events);
public void SaveToXml (string fileName, Microsoft.SqlServer.Dts.Runtime.Package package, Microsoft.SqlServer.Dts.Runtime.IDTSEvents events);
member this.SaveToXml : string * Microsoft.SqlServer.Dts.Runtime.Package * Microsoft.SqlServer.Dts.Runtime.IDTSEvents -> unit
Public Sub SaveToXml (fileName As String, package As Package, events As IDTSEvents)

Parâmetros

fileName
String

O nome do arquivo a ser salvo.

package
Package

O objeto de pacote a ser salvo.

events
IDTSEvents

Um objeto IDTSEvents.

Exemplos

O exemplo a seguir salva o pacote .dtsx no formato XML com o nome myXMLPackage.dtsx.

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

            Application app = new Application();  
            Package p = app.LoadPackage(pkg, null);  
            app.SaveToXml("myXMLPackage.dtsx", p, null);  
        }  
Shared  Sub Main(ByVal args() As String)  
            ' The variable pkg points to the location  
            ' of the ExecuteProcess package sample   
            ' that is installed with the SSIS samples.  
            Dim pkg As String =  "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx"   

            Dim app As Application =  New Application()   
            Dim p As Package =  app.LoadPackage(pkg,Nothing)   
            app.SaveToXml("myXMLPackage.dtsx", p, Nothing)  
End Sub  

Comentários

Um arquivo de pacote normalmente tem a extensão .dtsx.

Se o nome do arquivo especificado no fileName parâmetro não existir, ele será criado.

Aplica-se a