Reference 인터페이스

프로젝트에서 하나의 참조를 나타냅니다. 프로젝트에 참조를 포함시키면 이 참조에 포함된 모든 공용 멤버를 사용할 수 있습니다. 프로젝트에 다른 .NET 프로젝트, .NET 어셈블리 및 COM 개체에 대한 참조가 포함될 수 있습니다.

네임스페이스:  VSLangProj
어셈블리:  VSLangProj(VSLangProj.dll)

구문

‘선언
<GuidAttribute("35D6FB50-35B6-4C81-B91C-3930B0D95386")> _
Public Interface Reference
[GuidAttribute("35D6FB50-35B6-4C81-B91C-3930B0D95386")]
public interface Reference
[GuidAttribute(L"35D6FB50-35B6-4C81-B91C-3930B0D95386")]
public interface class Reference
[<GuidAttribute("35D6FB50-35B6-4C81-B91C-3930B0D95386")>]
type Reference =  interface end
public interface Reference

Reference 형식에서는 다음과 같은 멤버를 노출합니다.

속성

  이름 설명
Public 속성 BuildNumber 참조의 빌드 번호를 가져옵니다.읽기 전용.
Public 속성 Collection 이 속성을 지원하는 개체가 포함된 컬렉션이나 이 코드 구문에 포함된 컬렉션을 가져옵니다.
Public 속성 ContainingProject 선택한 항목의 일부인 프로젝트를 가져옵니다.읽기 전용.
Public 속성 CopyLocal 참조를 로컬 bin 경로로 복사할지 여부를 결정합니다.
Public 속성 Culture 참조의 문화권 문자열을 가져옵니다.읽기 전용.
Public 속성 Description 참조의 텍스트 설명을 가져옵니다.읽기 전용.
Public 속성 DTE 최상위 확장성 개체를 가져옵니다.
Public 속성 Extender 이 개체에 대해 존재하는 요청된 Extender 개체를 가져옵니다.
Public 속성 ExtenderCATID 개체의 Extender CATID(범주 ID)를 가져옵니다.
Public 속성 ExtenderNames 개체에 대해 사용할 수 있는 Extender의 목록을 가져옵니다.
Public 속성 Identity 참조의 고유 식별자를 가져옵니다.읽기 전용.
Public 속성 MajorVersion 참조의 주 버전 번호를 가져옵니다.읽기 전용.
Public 속성 MinorVersion 참조의 부 버전 번호를 가져옵니다.읽기 전용.
Public 속성 Name 개체 이름을 가져옵니다.읽기 전용.
Public 속성 Path 참조 파일의 경로를 가져옵니다.읽기 전용.
Public 속성 PublicKeyToken 참조된 어셈블리의 공개 키 토큰을 가져옵니다.
Public 속성 RevisionNumber 참조의 수정 번호를 가져옵니다.읽기 전용.
Public 속성 SourceProject 참조가 프로젝트이면 Project 개체를 가져오고그렇지 않으면 Nothing(nullNull 참조(Visual Basic의 경우 Nothing) 참조)을 반환합니다.읽기 전용.
Public 속성 StrongName 참조를 공개/개인 키 쌍으로 서명할지 여부를 가져옵니다.읽기 전용.
Public 속성 Type 참조가 어셈블리인지 아니면 COM 구성 요소인지를 나타내는 prjReferenceType 값을 가져옵니다.읽기 전용.
Public 속성 Version 선택한 참조의 버전을 가져옵니다.

위쪽

메서드

  이름 설명
Public 메서드 Remove 참조가 포함된 References 개체에서 참조를 제거합니다.

위쪽

설명

Reference 개체는 VSProject 개체의 References 컬렉션에 포함됩니다. Reference 개체에는 어셈블리(Visual Studio 프로젝트 포함) 개체와 COM 개체라는 두 가지 형식이 있습니다. 다른 프로젝트에 참조가 있는 경우 프로젝트간 참조라고 하며 어셈블리 참조로 간주됩니다.

예제

다음 예제에서는 템플릿에서 새 프로젝트를 만들고 2개의 참조를 추가한 다음 참조 형식을 표시합니다.

'Macro Editor
Imports VSLangProj
Sub NewProject()
   Dim newName As String = InputBox("New project name:")
   ' Create a new project in the solution based on an existing
   ' project.
   Dim newProject As Project = DTE.Solution.AddFromTemplate( _
      "C:\TemplatePath\Template.vbproj", _
      "C:\ProjectPath\" & newName, newName)
        
   ' Add a COM reference and display its type.
   Dim vsProject As VSProject = CType(newProject.Object, VSProject)
   Dim newRef As Reference
   newRef = vsProject.References.Add("C:\WINNT\System32\msmask32.ocx")
   MsgBox(GetRefTypeName(newRef))
        
   ' Add an Assembly reference and display its type, "Assembly".
   newRef = vsProject.References.Add("C:\SomeProject\bin\SomeProject.dll")
   MsgBox(GetRefTypeName(newRef))
End Sub

Private Function GetRefTypeName(ByVal ref As Reference) _
   As String
   Dim type As String
   Select Case ref.Type
      Case prjReferenceType.prjReferenceTypeActiveX
         type = "COM"
      Case prjReferenceType.prjReferenceTypeAssembly
         type = "Assembly"
   End Select
   Return type
End Function

다음 예제에서는 참조 속성에 대한 간단한 보고서를 작성합니다.

' Macro Editor
' Create a small report about a reference.
Imports VSLangProj
Function ReportReferences(ByVal aRef As Reference) As String
   Dim report As String = ""
   Dim type As String
   ' Each entry in the ArrayList will contain a label and a value.
   Dim ht As System.Collections.ArrayList = _
      New System.Collections.ArrayList()
   With aRef
      ht.Add(New String() {"Name", .Name})
      ht.Add(New String() {"Description", .Description})
      ht.Add(New String() {"Version", String.Format("{0}.{1}.{2}.{3}", _
         .MajorVersion, .MinorVersion, .BuildNumber, .RevisionNumber)})
      ht.Add(New String() {"Location", .ContainingProject.FullName})
      Select Case .Type
         Case prjReferenceType.prjReferenceTypeActiveX
            type = "COM"
         Case prjReferenceType.prjReferenceTypeAssembly
            type = "Assembly"
      End Select
      ht.Add(New String() {"Type", type})
      ht.Add(New String() {"Culture", .Culture})
   End With
        
   Dim datas() As String
   For Each datas In ht
      report &= datas(0) & ControlChars.Tab & datas(1) & ControlChars.CrLf
   Next
   Return report
End Function

참고 항목

참조

VSLangProj 네임스페이스