Reference3.MinorVersion-Eigenschaft

Ruft die Nebenversionsnummer des Verweises ab.

Namespace:  VSLangProj80
Assembly:  VSLangProj80 (in VSLangProj80.dll)

Syntax

'Declaration
ReadOnly Property MinorVersion As Integer
    Get
int MinorVersion { get; }
property int MinorVersion {
    int get ();
}
abstract MinorVersion : int
function get MinorVersion () : int

Eigenschaftswert

Typ: System.Int32
Eine ganze Zahl, deren Wert vom Verweistyp abhängt.

Verweistyp

Zurückgegebener Wert

Assembly

Nebenversionsnummer des Verweises; 0–9999.

COM

Ein Long-Wert.

Implementiert

Reference2.MinorVersion

Hinweise

Die Version eines Verweises wird anhand von vier Komponenten eindeutig identifiziert: Hauptversion, Nebenversion, Build und Revision. Die Hauptversion-Komponente und die Nebenversion-Komponente sind erforderlich. Die Revision-Komponente ist optional, wenn Build nicht definiert ist. COM-Objekte haben keine Revision-Komponente und keine Build-Komponente. Weitere Informationen finden Sie unter Assemblyversionen.

Beispiele

In diesem Beispiel werden einem geöffneten Visual Basic- oder Visual C#-Projekt eine Assembly und ein COM-Verweis hinzugefügt und anschließend die Nebenversionsnummern angezeigt. Um dieses Beispiel als Add-In auszuführen, informieren Sie sich unter Gewusst wie: Kompilieren und Ausführen der Codebeispiele für das Automatisierungsobjektmodell.

Die Standardpfade für den hinzugefügten Verweis lauten: <Stammpfad der Installation>\Programme\Microsoft.NET\Primary Interop Assemblies für adodb.dll und <Stammpfad der Installation>\Programme\Gemeinsame Dateien\SpeechEngines\Microsoft für spcommon.dll. Ersetzen Sie <Dateipfad> im Beispiel durch diese oder andere geeignete Dateipfade.

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());
}

.NET Framework-Sicherheit

Siehe auch

Referenz

Reference3 Schnittstelle

MinorVersion-Überladung

VSLangProj80-Namespace