How to Get the File Version of the Assembly in .NET (C#)?

The developers can use the methods and properties available in the FileVersionInfo class to retrieve the File Version of the Assembly in .NET (C#).

How to Get the File Version of the Assembly in .NET (C#)?

Below is a sample code snippet demonstrating how to retrieve it.

using System;

using System.Collections;

using System.Collections.Generic;

using System.Data;

using System.DirectoryServices.AccountManagement;

using System.IO;

using System.Linq;

using System.Net;

using System.Net.Sockets;

using System.Reflection;

namespace AbundantCode

{

internal class Program

{

// How to Get the File Version of the Assembly in .NET (C#)?

private static void Main(string[] args)

{

System.Reflection.Assembly CurrentAssembly = Assembly.GetExecutingAssembly();

System.Diagnostics.FileVersionInfo fileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(CurrentAssembly.Location);

Console.WriteLine(fileVersionInfo.FileVersion);

Console.ReadKey();

}

}

}
How to Get the File Version of the Assembly in .NET (C#)?