Retrieve Version Information for a File - CSharp File IO

CSharp examples for File IO:File

Description

Retrieve Version Information for a File

Demo Code


using System;//  www . ja  v a 2  s .com
using System.Diagnostics;

static class MainClass
{
    static void Main(string[] args)
    {
        FileVersionInfo info = FileVersionInfo.GetVersionInfo("c:/a/Main.cs");

        // Display version information.
        Console.WriteLine("Checking File: " + info.FileName);
        Console.WriteLine("Product Name: " + info.ProductName);
        Console.WriteLine("Product Version: " + info.ProductVersion);
        Console.WriteLine("Company Name: " + info.CompanyName);
        Console.WriteLine("File Version: " + info.FileVersion);
        Console.WriteLine("File Description: " + info.FileDescription);
        Console.WriteLine("Original Filename: " + info.OriginalFilename);
        Console.WriteLine("Legal Copyright: " + info.LegalCopyright);
        Console.WriteLine("InternalName: " + info.InternalName);
        Console.WriteLine("IsDebug: " + info.IsDebug);
        Console.WriteLine("IsPatched: " + info.IsPatched);
        Console.WriteLine("IsPreRelease: " + info.IsPreRelease);
        Console.WriteLine("IsPrivateBuild: " + info.IsPrivateBuild);
        Console.WriteLine("IsSpecialBuild: " + info.IsSpecialBuild);

    }
}

Result


Related Tutorials