FileVersionInfo 클래스

정의

디스크에 있는 물리적 파일에 대한 버전 정보를 제공합니다.

public ref class FileVersionInfo sealed
public sealed class FileVersionInfo
type FileVersionInfo = class
Public NotInheritable Class FileVersionInfo
상속
FileVersionInfo

예제

다음 예제에서는 를 호출 GetVersionInfo 하여 메모장에 대한 를 가져옵니다 FileVersionInfo . 그런 다음, 파일 설명 및 버전 번호를 콘솔에 출력합니다.

#using <System.dll>

using namespace System;
using namespace System::IO;
using namespace System::Diagnostics;


public ref class Class1
{
    
public:
    static void Main()
    {
        // Get the file version for the notepad.
        // Use either of the two following methods.
        FileVersionInfo::GetVersionInfo(Path::Combine(Environment::SystemDirectory, "Notepad.exe"));
        FileVersionInfo^ myFileVersionInfo = FileVersionInfo::GetVersionInfo(Environment::SystemDirectory + "\\Notepad.exe");


        // Print the file name and version number.
        Console::WriteLine("File: " + myFileVersionInfo->FileDescription + "\n" +
           "Version number: " + myFileVersionInfo->FileVersion);
    }
};

int main()
{
    Class1::Main();
}

using System;
using System.IO;
using System.Diagnostics;

class Class1
{
    public static void Main(string[] args)
    {
        // Get the file version for the notepad.
        // Use either of the two following commands.
        FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "Notepad.exe"));
        FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\\Notepad.exe");

        // Print the file name and version number.
        Console.WriteLine("File: " + myFileVersionInfo.FileDescription + '\n' +
           "Version number: " + myFileVersionInfo.FileVersion);
    }
}
Imports System.IO
Imports System.Diagnostics



Class Class1

    Public Shared Sub Main(ByVal args() As String)
        ' Get the file version for the notepad.
        ' Use either of the following two commands.
        FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "Notepad.exe"))
        Dim myFileVersionInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\Notepad.exe")


        ' Print the file name and version number.
        Console.WriteLine("File: " + myFileVersionInfo.FileDescription + vbLf + "Version number: " + myFileVersionInfo.FileVersion)

    End Sub
End Class

설명

일반적으로 버전 번호는 "major number.minor number.build number.private part number"로 표시됩니다. 파일 버전 번호는 다음과 같이 파일의 버전 번호를 포함하는 64비트 번호입니다.

이 클래스의 GetVersionInfo 메서드를 FileVersionInfo 사용하여 파일에 대한 정보를 포함하는 를 가져옵니다. 그런 다음 속성에서 파일에 대한 정보를 확인합니다. 속성은 FileVersion 파일에 대한 버전 정보를 제공합니다. , ProductMinorPart, ProductBuildPart, ProductPrivatePartProductVersion 속성은 ProductMajorPart지정된 파일이 속한 제품에 대한 버전 정보를 제공합니다. 를 호출 ToString 하여 이 파일에 대한 속성 및 해당 값의 일부 목록을 가져옵니다.

속성은 FileVersionInfo 파일에 기본 제공되는 버전 리소스 정보를 기반으로 합니다. 버전 리소스는 종종 .exe 또는 .dll 파일과 같은 이진 파일에 기본 제공됩니다. 텍스트 파일에 버전 리소스 정보가 없습니다.

버전 리소스는 일반적으로 Win32 리소스 파일 또는 어셈블리 특성에 지정됩니다. 예를 들어 속성은 IsDebug Win32 리소스 파일의 리소스에서 VERSIONINFO 빌드된 파일 블록의 VS_FIXEDFILEINFO 플래그 값을 반영 VS_FF_DEBUG 합니다. Win32 리소스 파일에서 버전 리소스를 지정하는 방법에 대한 자세한 내용은 플랫폼 SDK의 "리소스 파일 정보" 및 "VERSIONINFO 리소스"를 참조하세요. .NET 모듈에서 버전 리소스를 지정하는 방법에 대한 자세한 내용은 어셈블리 특성 설정 항목을 참조하세요.

참고

이 클래스는 모든 멤버에 적용되는 클래스 수준에서 링크 요청을 만듭니다. 즉시 SecurityException 호출자에게 완전 신뢰 권한이 없는 경우 이 throw됩니다. 링크 요구 사항에 대한 자세한 내용은 링크 요구를 참조하세요.

속성

Comments

파일과 관련된 주석을 가져옵니다.

CompanyName

파일을 만든 회사의 이름을 가져옵니다.

FileBuildPart

파일의 빌드 번호를 가져옵니다.

FileDescription

파일에 대한 설명을 가져옵니다.

FileMajorPart

버전 번호의 주 부분을 가져옵니다.

FileMinorPart

파일에 대한 버전 번호의 부 부분을 가져옵니다.

FileName

FileVersionInfo의 이 인스턴스가 설명하는 파일의 이름을 가져옵니다.

FilePrivatePart

파일 프라이빗 부분 번호를 가져옵니다.

FileVersion

파일 버전 번호를 가져옵니다.

InternalName

파일의 내부 이름이 있으면 가져옵니다.

IsDebug

파일에 디버깅 정보가 포함되어 있는지 여부 또는 디버깅 기능이 활성화된 상태에서 파일이 컴파일되었는지 여부를 지정하는 값을 가져옵니다.

IsPatched

파일을 수정했는지 여부와 파일이 버전 번호가 같은 원래 전달 파일과 다른지 여부를 지정하는 값을 가져옵니다.

IsPreRelease

파일이 상업용으로 출시된 제품이 아닌 개발 버전인지 여부를 지정하는 값을 가져옵니다.

IsPrivateBuild

표준 릴리스 프로시저를 사용하여 파일을 빌드했는지 여부를 지정하는 값을 가져옵니다.

IsSpecialBuild

파일이 특수 빌드인지 여부를 지정하는 값을 가져옵니다.

Language

버전 정보 블록의 기본 언어 문자열을 가져옵니다.

LegalCopyright

지정된 파일에 적용되는 저작권 표시를 모두 가져옵니다.

LegalTrademarks

파일에 적용되는 상표와 등록 상표를 가져옵니다.

OriginalFilename

파일을 만들 때 사용한 이름을 가져옵니다.

PrivateBuild

프라이빗 버전 파일에 대한 정보를 가져옵니다.

ProductBuildPart

이 파일과 관련된 제품의 빌드 번호를 가져옵니다.

ProductMajorPart

이 파일과 관련된 제품에 대한 버전 번호의 주 부분을 가져옵니다.

ProductMinorPart

파일과 관련된 제품에 대한 버전 번호의 부 부분을 가져옵니다.

ProductName

이 파일과 함께 배포된 제품의 이름을 가져옵니다.

ProductPrivatePart

이 파일과 관련된 제품의 프라이빗 부분 번호를 가져옵니다.

ProductVersion

이 파일과 함께 배포된 제품의 버전을 가져옵니다.

SpecialBuild

파일에 대한 특수 빌드 정보를 가져옵니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
GetVersionInfo(String)

지정된 파일과 관련된 버전 정보를 나타내는 FileVersionInfo 를 반환합니다.

MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

FileVersionInfo의 속성과 해당 값에 대한 일부 목록을 반환합니다.

적용 대상

추가 정보