Reputation: 126
Anyone knows why am I having different file versions of a executable file in windows properties and visual Studio?
I'm querying the same file... for sure! What am I mising....
This is my code:
private string getFileVersion(string filePath)
{
try
{
return FileVersionInfo.GetVersionInfo(filePath).FileVersion;
}
catch (FileNotFoundException ex)
{
mLogFile.addLogEntry("XML file. " + ex.Message);
return null;
}
}
UPDATE:The File I'm querying it is not the project executable file.
thanks
Upvotes: 0
Views: 126
Reputation: 11703
The developer of that application didn't update the "FileVersion" string to match the information in the other properties.
Build the file version information from the following information:
FileVersionInfo info = FileVersionInfo.GetVersionInfo(filePath);
String version = String.Format("{0}.{1}.{2}.{3}", info.FileMajorPart
, info.FileMinorPart
, info.FileBuildPart
, info.FilePrivatePart);
Upvotes: 3