How to get .exe file version number from file path
问题 I am using .Net 3.5/4.0 with code in C#. I am trying to get a version number of an exe file on my C: drive. For example path is: c:\Program\demo.exe. If the version number of demo.exe is 1.0. How can i use this path to grab version number?. 回答1: You can use FileVersionInfo.ProductVersion to fetch this from a path. var versionInfo = FileVersionInfo.GetVersionInfo(pathToExe); string version = versionInfo.ProductVersion; // Will typically return "1.0.0" in your case 回答2: Updated and modernized