Nuno
Nuno

Reputation: 126

Different File Versions in Visual Studio and windows Properties

Anyone knows why am I having different file versions of a executable file in windows properties and visual Studio?

Windows File Version

Visual Studio File Version

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

Answers (1)

Black Frog
Black Frog

Reputation: 11703

The developer of that application didn't update the "FileVersion" string to match the information in the other properties.

enter image description here

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

Related Questions