Package.VersionGUID 属性

定义

获取第一次创建包时生成的版本 GUID。 此字段为只读。

public:
 property System::String ^ VersionGUID { System::String ^ get(); };
[Microsoft.SqlServer.Dts.Runtime.Localization.LocalizablePropertyCategory(typeof(Microsoft.SqlServer.Dts.Runtime.Localized), "PropertyCategoryVersion")]
[Microsoft.SqlServer.Dts.Runtime.Localization.LocalizablePropertyDescription(typeof(Microsoft.SqlServer.Dts.Runtime.Localized), "VersionGUIDDesc")]
public string VersionGUID { get; }
[<Microsoft.SqlServer.Dts.Runtime.Localization.LocalizablePropertyCategory(typeof(Microsoft.SqlServer.Dts.Runtime.Localized), "PropertyCategoryVersion")>]
[<Microsoft.SqlServer.Dts.Runtime.Localization.LocalizablePropertyDescription(typeof(Microsoft.SqlServer.Dts.Runtime.Localized), "VersionGUIDDesc")>]
member this.VersionGUID : string
Public ReadOnly Property VersionGUID As String

属性值

String

包的版本 GUID。

属性

示例

以下示例从随 SSIS 示例安装的包检索版本信息。

using System;  
using System.Collections.Generic;  
using System.Text;  
using Microsoft.SqlServer.Dts.Runtime;  

namespace Package_API  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            Application app = new Application();  
            Package pkg = new Package();  
            pkg = app.LoadPackage(@"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx", null);  

            // Review several properties on the sample package using different techniques.  
            int pkgBuild = pkg.VersionBuild;  
            int pkgVerMajor = pkg.VersionMajor;  
            int pkgVerMinor = pkg.VersionMinor;  
            String entireVersion = pkgVerMajor.ToString() + "." + pkgVerMinor.ToString();  

            Console.WriteLine("Build number for package {0}", pkgBuild);  
            Console.WriteLine("any comments? {0}", pkg.VersionComments);  
            Console.WriteLine("What is the GUID? {0}", pkg.VersionGUID);  
            Console.WriteLine("Version numbers {0}", entireVersion);  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Namespace Package_API  
    Class Program  
        Shared  Sub Main(ByVal args() As String)  
            Dim app As Application =  New Application()   
            Dim pkg As Package =  New Package()   
            pkg = app.LoadPackage("C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx", Nothing)  

            ' Review several properties on the sample package using different techniques.  
            Dim pkgBuild As Integer =  pkg.VersionBuild   
            Dim pkgVerMajor As Integer =  pkg.VersionMajor   
            Dim pkgVerMinor As Integer =  pkg.VersionMinor   
            Dim entireVersion As String =  pkgVerMajor.ToString() + "." + pkgVerMinor.ToString()   

            Console.WriteLine("Build number for package {0}", pkgBuild)  
            Console.WriteLine("any comments? {0}", pkg.VersionComments)  
            Console.WriteLine("What is the GUID? {0}", pkg.VersionGUID)  
            Console.WriteLine("Version numbers {0}", entireVersion)  
        End Sub  
    End Class  
End Namespace  

示例输出:

Build number for package 143

any comments?

What is the GUID? {0FF64FA0-2FB7-49C1-BB20-6439EDD1EE44}

Version numbers 1.0

适用于