1

I see that the definition of GetExecutingAssembly() is that it returns the assembly that contains the code that is currently executing.

The code that I have is

Assembly.GetExecutingAssembly().GetName().Version

However, when I run the program, that line always returns version that is different from the file version on the DLL. So I see that the DLL has file version and product version of 7.1 but that line above always returns 7.0

How could this possibly happen?

user1542422
  • 309
  • 1
  • 4
  • 13

1 Answers1

3

try this , to get file version and not assembly version

var assembly = System.Reflection.Assembly.GetExecutingAssembly();
var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
var version = fvi.FileVersion;
Shachaf.Gortler
  • 5,655
  • 14
  • 43
  • 71