FileVersionInfo.FileVersion abnormal for C:\system32\notepad.exe

Copper Contributor

 

https://aka.ms/dc/image?name=B27799a80192a4419937574367550cb38638037337624347707_filever.jpg&tid=27799a80192a4419937574367550cb38638037337624347707

I need to get thefile version information for files.
I use the following code to get file version
But I got differenct FileVersion event if it show the same version in the file property.

```
FileVersionInfo info = FileVersionInfo.GetVersionInfo(args[1]);
Console.WriteLine(info.FileVersion);
```

 

I copy the C:\windows\system32\notepad.exe then rename it as "notepad2.exe"
So the binary hash is the same. It also show the same verison in the file property.
But if I get FileVersion through FileVersionInfo .FileVersion

the orginal notepad.exe show "10.0.19041.2130 (WinBuild.160101.0800)"
the copy one show "10.0.19041.1865 (WinBuild.160101.0800)"

Do I call the wroing api to get file version?
What is the correct api I need to call to get the correct file version?

1 Reply

Hi @Kinki_Wu,

Thanks for posting your issue here.

However this platform is used for how-to discussions and sharing best practices for building any app with .NET.Since your issue is a technical question, welcome to post it in Microsoft Q&A forum, the support team and communities on Microsoft Q&A will help you for any technical questions.
Besides, it will be appreciated if you can share it here once you post this technical question Microsoft Q&A.
Best Regards,
Lan Huang