Method GetVersionInfo
GetVersionInfo(string)
Retrieves version information from the specified file as a dictionary of key-value pairs.
public static IDictionary<string, string> GetVersionInfo(string filePath)
Parameters
filePathstringThe path to the file from which to extract version information. Must not be null or empty.
Returns
- IDictionary<string, string>
A dictionary containing version information fields and their values. The dictionary is empty if the file does not exist or if version information cannot be retrieved.
Remarks
The returned dictionary may include fields such as "FileVersion", "ProductVersion", "CompanyName", and others, depending on the information available in the file's version resources. If the file does not contain version information or an error occurs during retrieval, the dictionary will be empty. This method uses both managed and native Windows APIs to extract as much version information as possible.
Exceptions
- ArgumentNullException
Thrown if
filePathis null or empty.- PlatformNotSupportedException
Thrown if the current operating system is not Windows.