Reference3.MajorVersion 속성

참조의 주 버전 번호를 가져옵니다.

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

구문

‘선언
ReadOnly Property MajorVersion As Integer
int MajorVersion { get; }
property int MajorVersion {
    int get ();
}
abstract MajorVersion : int
function get MajorVersion () : int

속성 값

형식: System.Int32
참조 형식에 따라 값이 달라지는 정수입니다.

참조 형식

반환 값

Assembly

참조의 주 릴리스 번호(0–9999)

COM

Int 값

설명

참조의 버전은 주 버전, 부 버전, 빌드 버전 및 수정 버전이라는 네 가지 구성 요소로 고유하게 식별됩니다.주 버전 및 부 버전 구성 요소는 필수적 요소입니다.빌드 버전 구성 요소가 정의되지 않은 경우 수정 버전 구성 요소는 선택적 요소입니다.COM 개체에는 수정 버전 및 빌드 버전 구성 요소가 없습니다.자세한 내용은 어셈블리 버전 관리를 참조하십시오.

예제

이 예제에서는 열린 Visual Basic 또는 Visual C# 프로젝트에 어셈블리 및 COM 참조를 추가하고 각 참조의 주 버전 번호를 표시합니다. 이 예제를 추가 기능으로 실행하려면 방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행을 참조하십시오.

추가되는 참조의 기본 경로는 adodb.dll의 경우 <설치 루트>\Program Files\Microsoft.NET\Primary Interop Assemblies이고 spcommon.dll의 경우 <설치 루트>\Program Files\Common Files\SpeechEngines\Microsoft입니다.예제의 <file path>를 이 경로 또는 적절한 다른 파일 경로로 바꿉니다.

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)
    GetMajorVersion(applicationObject)
End Sub
Sub GetMajorVersion(ByVal dte As DTE2)
    Dim aProject As Project
    Dim aVSProject As VSProject2
    aProject = applicationObject.Solution.Projects.Item(1)
    aVSProject = _
    CType(applicationObject.Solution.Projects.Item(1).Object, _
    VSProject2)
    ' Add an Assembly reference and display its major version.
    ' Replace <file path> with an actual file path.
    Dim newRef As Reference3
    newRef = _
    CType(aVSProject.References.Add("<file path>\adodb.dll"), _
    Reference3)
    MsgBox("Added an Assembly reference, named: " & newRef.Name)
    MsgBox("The Major version of " & newRef.Name & " is " _
    & newRef.MajorVersion.ToString())
    ' Add a COM reference and display its major version.
    ' Replace <file path> with an actual file path.
    newRef = CType(aVSProject.References.Add _
    ("<file path>\spcommon.dll"),_
    Reference3)
    MsgBox("Added a COM reference, named: " & newRef.Name)
    MsgBox("The major version of " & newRef.Name & " is " _
    & newRef.MajorVersion.ToString())
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;
    GetMajorVersion(((DTE2)applicationObject));
}
public void GetMajorVersion(DTE2 dte)
{
    // The first project is a Visual Basic or C# project.
    VSProject2 vsProject =
((VSProject2)(applicationObject.Solution.Projects.Item(1).Object));
    Reference3 aRef = null;
    // Add an Assembly reference and display its major version.
    // Replace <file path> with an actual file path.
    aRef = (Reference3)vsProject.References.Add
((@"<file path>\adodb.dll"));
    MessageBox.Show("Added an Assembly reference, named: " 
+ aRef.Name);
    MessageBox.Show("The major version of " + aRef.Name + " is " 
+ aRef.MajorVersion.ToString());
    // Add a COM reference and display its major version.
    // Replace <file path> with an actual file path.
    aRef = (Reference3)vsProject.References.Add
((@"<file path>\spcommon.dll"));
    MessageBox.Show("Added a COM reference, named: "+ aRef.Name);
    MessageBox.Show("The major version of " + aRef.Name + " is " 
+ aRef.MajorVersion.ToString());
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

Reference3 인터페이스

MajorVersion 오버로드

VSLangProj80 네임스페이스