简体   繁体   中英

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文件版本

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

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM