Reference3.Name Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the name of the object.
public:
property System::String ^ Name { System::String ^ get(); };
public:
property Platform::String ^ Name { Platform::String ^ get(); };
[System.Runtime.InteropServices.DispId(5)]
public string Name { [System.Runtime.InteropServices.DispId(5)] get; }
[<System.Runtime.InteropServices.DispId(5)>]
[<get: System.Runtime.InteropServices.DispId(5)>]
member this.Name : string
Public ReadOnly Property Name As String
Property Value
The returned string depends on the reference type.Reference TypeValue ReturnedAssemblyThe assembly name, which is the file name of the reference without the extension.COMThe name of the wrapper for the referenced type library, which is the file name without the extension.
Implements
- Attributes
Examples
This example displays the name of the first reference 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.
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)
GetName(applicationObject)
End Sub
Sub GetName(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)
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;
GetName(((DTE2)applicationObject));
}
public void GetName(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 name of the first reference in the project
is: " + aRef.Name);
}
Remarks
This property specifies the .NET Framework name of the referenced assembly, whether the assembly is a .NET Framework assembly or a wrapper for a COM type library.