Compartir a través de


Reference3.MinorVersion Property

Definition

Gets the minor version number of the reference.

public:
 property int MinorVersion { int get(); };
public:
 property int MinorVersion { int get(); };
[System.Runtime.InteropServices.DispId(12)]
public int MinorVersion { [System.Runtime.InteropServices.DispId(12)] get; }
[<System.Runtime.InteropServices.DispId(12)>]
[<get: System.Runtime.InteropServices.DispId(12)>]
member this.MinorVersion : int
Public ReadOnly Property MinorVersion As Integer

Property Value

An integer whose value depends on the reference type.Reference TypeValue ReturnedAssemblyMinor release number of the reference; 0–9999. COMA long value.

Implements

Attributes

Examples

This example adds an Assembly and a COM reference to an open Visual Basic or Visual C# project and displays their minor version numbers. To run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples.

The default paths for the reference added are: <installation root>\Program Files\Microsoft.NET\Primary Interop Assemblies for adodb.dll, and <installation root>\Program Files\Common Files\SpeechEngines\Microsoft for spcommon.dll. Replace <file path> in the example with these or other appropriate file paths.

Imports VSLangProj  
Imports VSLangProj2  
Imports VSLangProj80  
Public Sub OnConnection(ByVal application As Object, _  
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _  
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection  
    applicationObject = CType(application, DTE2)  
    addInInstance = CType(addInInst, AddIn)  
    GetMinorVersion(applicationObject)  
End Sub  
Sub GetMinorVersion (ByVal dte As DTE2)  
    Dim aProject As Project  
    Dim aVSProject As VSProject2  
    aProject = applicationObject.Solution.Projects.Item(1)  
    aVSProject = _  
    CType(applicationObject.Solution.Projects.Item(1).Object, _  
    VSProject2)  
    ' Add an Assembly reference and display its minor version.  
    Dim newRef As Reference3  
    ' Replace <file path> with an actual file path.  
    newRef = _  
    CType(aVSProject.References.Add("<file path>\adodb.dll"), _  
    Reference3)  
    MsgBox("Added an Assembly reference, named: " & newRef.Name)  
    MsgBox("The minor version of " & newRef.Name & " is " _  
    & newRef.MinorVersion.ToString())  
    ' Add a COM reference and display its minor version.  
    ' Replace <file path> with an actual file path.  
    newRef = CType(aVSProject.References.Add _  
    ("<file path>\spcommon.dll"),_  
    Reference3)  
    MsgBox("Added a COM reference, named: " & newRef.Name)  
    MsgBox("The minor version of " & newRef.Name & " is " _  
    & newRef.MinorVersion.ToString())  
End Sub  
using System.Windows.Forms;  
using VSLangProj;  
using VSLangProj2;  
using VSLangProj80;  
public void OnConnection(object application,   
ext_ConnectMode connectMode, object addInInst, ref Array custom)  
{  
    applicationObject = (DTE2)application;  
    addInInstance = (AddIn)addInInst;  
    GetMinorVersion (((DTE2)applicationObject));  
}  
public void GetMinorVersion (DTE2 dte)  
{  
    // The first project is a Visual Basic or C# project.  
    VSProject2 vsProject =  
((VSProject2)(applicationObject.Solution.Projects.Item(1).Object));  
    Reference3 aRef = null;  
    // Add an Assembly reference and display its minor version.  
    // Replace <file path> with an actual file path.  
    aRef = (Reference3)vsProject.References.Add  
((@"<file path>\adodb.dll"));  
    MessageBox.Show("Added an Assembly reference, named: "   
+ aRef.Name);  
    MessageBox.Show("The minor version of " + aRef.Name + " is "   
+ aRef.MinorVersion.ToString());  
    // Add a COM reference and display its minor version.  
    // Replace <file path> with an actual file path.  
    aRef = (Reference3)vsProject.References.Add  
((@"<file path>\spcommon.dll"));  
    MessageBox.Show("Added a COM reference, named: "+ aRef.Name);  
    MessageBox.Show("The minor version of " + aRef.Name + " is "   
+ aRef.MinorVersion.ToString());  
}  

Remarks

The version of a reference is uniquely identified by four components: major, minor, build, and revision. The major and minor components are required. The revision component is optional when build is not defined. COM objects do not have revision and build components. For more information, see Assembly Versioning.

Applies to