Share via


IVSSVersion.VersionNumber Property 

Gets a version number of the file or project version.

Namespace: Microsoft.VisualStudio.SourceSafe.Interop
Assembly: Microsoft.VisualStudio.SourceSafe.Interop (in microsoft.visualstudio.sourcesafe.interop.dll)

Syntax

'Declaration
ReadOnly Property VersionNumber As Integer
'Usage
Dim instance As IVSSVersion
Dim value As Integer

value = instance.VersionNumber
int VersionNumber { get; }
property int VersionNumber {
    int get ();
}
/** @property */
int get_VersionNumber ()
function get VersionNumber () : int

Property Value

A version number of the file or project version.

Remarks

[IDL]

HRESULT VersionNumber ([out,retval]long *piVersion);

The version number is one-based and is incremented each time the new version is added.

Example

The following example demonstrates how to iterate through the IVSSVersions collection of a file and display the VersionNumber property for each version.

using System;
using Microsoft.VisualStudio.SourceSafe.Interop;

public class IVSSTest
{
    public static void Main()
    {
        string testFile = "$/A/test.txt";

        // Create a VSSDatabase object.
        IVSSDatabase vssDatabase = new VSSDatabase();

        // Open a VSS database using network name 
        // for automatic user login.
        vssDatabase.Open(@"C:\VSSTestDB\srcsafe.ini", 
                         Environment.UserName, ""); 

        Console.WriteLine("\n$/A/test.txt versions: \n");
        Console.WriteLine("-------------------------------------------------------");
        Console.WriteLine("{0,-4}{1,-14}{2,-15}{3,-16}", "Ver", 
                          "Comment", "Action", "Date");
        Console.WriteLine("-------------------------------------------------------");
        IVSSItem vssFile = vssDatabase.get_VSSItem(testFile, false);
        foreach(IVSSVersion vssVersion in vssFile.get_Versions(0))    
            Console.WriteLine("{0,-4}{1,-14}{2,-15}{3,-16}", 
                              vssVersion.VersionNumber, vssVersion.Comment, 
                              vssVersion.Action, vssVersion.Date);
        Console.WriteLine("-------------------------------------------------------");
    }
}

Output:
$/A/test.txt versions:
-------------------------------------------------------
Ver Comment       Action         Date
-------------------------------------------------------
14                Labeled 'Lbl1' 11/8/2003 12:41:12 PM
3   Ver 3         Checked in $/A 11/4/2003 10:47:30 PM
2   Ver 2         Checked in $/A 11/4/2003 10:46:48 PM
1                 Created        11/4/2003 10:45:52 PM
-------------------------------------------------------

See Also

Reference

IVSSVersion Interface
IVSSVersion Members
Microsoft.VisualStudio.SourceSafe.Interop Namespace