Reference3.Version Property

Definition

Gets the version of the specified reference.

C++/CX
public:
 property Platform::String ^ Version { Platform::String ^ get(); };

Property Value

A string representing the version number.

Implements

Attributes

Examples

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

VB
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)  
    DisplayVersion(applicationObject)  
End Sub  
Public Sub DisplayVersion(ByVal dte As DTE2)  
    ' The first project is a Visual Basic or C# project.  
    Dim vsProject As VSProject2 = _  
    CType(applicationObject.Solution.Projects.Item(1).Object, _  
    VSProject2)  
    Dim aRef As Reference3  
    Dim refStr As String  
    refStr = ""  
    For Each aRef In VSProject.References  
        refStr += (aRef.Name & " has a version number: " _  
        & aRef.Version & vbCr & vbCr)  
    Next  
    MsgBox(refStr)  
End Sub  

Remarks

The version number is in the format:

Major version + Minor version + Build version + Revision.

For example, 10.3.5400.3.

Applies to

製品 バージョン
Visual Studio SDK 2015, 2017, 2019, 2022