FileVersionInfo.FileVersion Vlastnost

Definice

Získá číslo verze souboru.

public:
 property System::String ^ FileVersion { System::String ^ get(); };
public string? FileVersion { get; }
public string FileVersion { get; }
member this.FileVersion : string
Public ReadOnly Property FileVersion As String

Hodnota vlastnosti

Číslo verze souboru nebo null jestli soubor neobsahoval informace o verzi.

Příklady

Následující příklad volá GetVersionInfo pro získání pro FileVersionInfo Poznámkový blok. Potom v textovém poli vytiskne popis souboru a číslo verze. Tento kód předpokládá, že textBox1 došlo k vytvoření instance.

#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

Poznámky

Číslo verze se obvykle zobrazuje jako "hlavní číslo.podverze.číslo buildu.číslo soukromé části". Číslo verze souboru je 64bitové číslo, které obsahuje číslo verze souboru takto:

Platí pro

Viz také