File Version and Assembly Version
What is the difference between File Version and Assembly version in c# with suitable simple exambles ?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
ShankeyRank #972 · 2.1K reputationPosted Mar 14, 2011, 2:13 AM EDT
VulpesRank #55 · 29.2K reputationPosted Mar 14, 2011, 2:38 AM EDT
Here's a quick example (compile this to version.exe):
using System;
using System.Diagnostics;
using System.Reflection;
class Version
{
static void Main()
{
string fileVersion = FileVersionInfo.GetVersionInfo("version.exe").FileVersion;
Console.WriteLine(fileVersion);
string assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
Console.WriteLine(assemblyVersion);
string fileVersion2 = FileVersionInfo.GetVersionInfo(@"c:\windows\system32\notepad.exe").FileVersion;
Console.WriteLine(fileVersion2);
Console.ReadKey();
}
}
On my Windows 7 machine, the output is:
0.0.0.0
0.0.0.0
6.1.7600.16385 (win7_rtm.090713-1255)
Suthish NairRank #92 · 22.8K reputationPosted Mar 16, 2011, 9:55 AM EDT