Reference3.RuntimeVersion Property
Gets the version of the runtime against which the reference was built. This is applicable only for .NET references.
Namespace: VSLangProj80
Assembly: VSLangProj80 (in VSLangProj80.dll)
Syntax
'Declaration
ReadOnly Property RuntimeVersion As String
string RuntimeVersion { get; }
property String^ RuntimeVersion {
String^ get ();
}
abstract RuntimeVersion : string with get
function get RuntimeVersion () : String
Property Value
Type: System.String
A string representing the version of the runtime against which the .NET reference was built.
Examples
This example displays the runtime version for the first reference of 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.
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)
GetRuntimeVersion(applicationObject)
End Sub
Sub GetRuntimeVersion(ByVal dte As DTE2)
Dim aProject As Project
Dim aVSProject As VSProject2
' The first project is a Visual Basic or C# project.
aProject = applicationObject.Solution.Projects.Item(1)
aVSProject =_
CType(applicationObject.Solution.Projects.Item(1).Object _
, VSProject2)
Dim newRef As Reference3
newRef = CType(aVSProject.References.Item(1), Reference3)
MsgBox("The name of the first reference in the project is: " _
& newRef.Name & vbCr & "its runtime version is: " _
& newRef.RuntimeVersion)
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;
GetRuntimeVersion(((DTE2)applicationObject));
}
public void GetRuntimeVersion(DTE2 dte)
{
// The first project is a Visual Basic or C# project.
VSProject2 aVSProject =
((VSProject2)(applicationObject.Solution.Projects.Item(1).Object));
Reference3 aRef = null;
aRef = ((Reference3)(aVSProject.References.Item(1)));
MessageBox.Show("The first reference in the project is: "
+ aRef.Name + "\n" + "and its runtime version is: "
+ aRef.RuntimeVersion);
}
.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.