Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Gets the version of the specified reference.
Namespace: VSLangProj80
Assembly: VSLangProj80 (in VSLangProj80.dll)
Syntax
'Declaration
ReadOnly Property Version As String
'Usage
Dim instance As Reference3
Dim value As String
value = instance.Version
string Version { get; }
property String^ Version {
String^ get ();
}
function get Version () : String
Property Value
Type: System.String
A string representing the version number.
Implements
Remarks
The version number is in the format:
Major version + Minor version + Build version + Revision.
For example, 10.3.5400.3.
Examples
This example iterates through references and displays their version numbers in an open Visual Basic, Visual C#, or Visual J# project. To run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples.
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, C#, or J# 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
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;
DisplayVersion(((DTE2)applicationObject));
}
public void DisplayVersion(DTE2 dte)
{
// The first project is a Visual Basic, C#, or J# project.
VSProject2 aProject =
((VSProject2)(applicationObject.Solution.Projects.Item(1).Object));
Reference3 aRef = null;
string refStr = null;
refStr = "";
foreach (VSLangProj80.Reference3 temp in aProject.References)
{
aRef = temp;
refStr += (aRef.Name + " has a version number: " +aRef.Version
+ "\n" + "\n");
}
MessageBox.Show(refStr);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.