fileversioninfo

Can't read FileVersionInfo with Code Page mismatch

风格不统一 提交于 2020-01-09 10:54:09
问题 I have some reasonably tried and tested code which uses the Windows API calls to read FileVersionInfo strings, like "FileVersion" and "CompanyName". I found it failed with one particular 3rd party DLL. The problem seems to be this: Reading the \VarFileInfo\Translation value, I get 040904B0 (US English, Unicode). But when I then attempt to call VerQueryValue on \StringFileInfo\040904B0\CompanyName , it returns false. But tweaking the code to use the Windows Latin-1 ANSI codepage works:

How to get .exe file version number from file path

孤人 提交于 2019-12-28 11:43:20
问题 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

How to get .exe file version number from file path

白昼怎懂夜的黑 提交于 2019-12-28 11:41:11
问题 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

How do I set the version information for an existing .exe, .dll?

流过昼夜 提交于 2019-12-17 02:26:39
问题 As part of our build process I need to set the version information for all of our compiled binaries. Some of the binaries already have version information (added at compile time) and some do not. I want to be able to apply the following information: Company Name Copyright Notice Product Name Product Description File Version Product Version All of these attributes are specified by the build script and must be applied after compilation. These are standard binaries (not assemblies) compiled with

Compiler error when using GetStringFileInfo in InnoSetup on application created with PyInstaller

南楼画角 提交于 2019-12-10 10:38:45
问题 I created version info file as described here - What does a "version file" look like? and do got EXE-file with all version information. My issue is next, when I try to build setup file with InnoSetup, I'm getting an error: Error on line 65 in d:\installation\Source\setup_script.iss: Missing closing quote on parameter "Name" line 65: [Icons] Name: "{group}\{#VerInfoProductName}"; Filename: "{app}\{#ExeFileName}.exe"; WorkingDir: "{app}" Definition of VerInfoProductName below #define

Compiler error when using GetStringFileInfo in InnoSetup on application created with PyInstaller

◇◆丶佛笑我妖孽 提交于 2019-12-06 15:42:45
I created version info file as described here - What does a "version file" look like? and do got EXE-file with all version information. My issue is next, when I try to build setup file with InnoSetup, I'm getting an error: Error on line 65 in d:\installation\Source\setup_script.iss: Missing closing quote on parameter "Name" line 65: [Icons] Name: "{group}\{#VerInfoProductName}"; Filename: "{app}\{#ExeFileName}.exe"; WorkingDir: "{app}" Definition of VerInfoProductName below #define VerInfoProductName GetStringFileInfo(AddBackslash(SourcePath) + "..\..\dist\app\testapp.exe", "ProductName")

How do I get the .exe name of a C# console application?

此生再无相见时 提交于 2019-12-04 10:01:46
问题 I'm debugging "xiixtasks.exe", a C# console-mode application in VS2008. I'm trying to get the version info from xiixtasks.exe. When I try "Process.GetCurrentProcess()", it gives me the filename and version info for vshost.exe, NOT xiixtasks.exe: // WRONG: this gives me xiixtasks.vhost.exe, version 9.0.30729.1 // I *want* "xiixtasks.exe", version 1.0.0.1024 System.Diagnostics.FileVersionInfo fi = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileVersionInfo; What should I be doing

How do I get the .exe name of a C# console application?

被刻印的时光 ゝ 提交于 2019-12-03 04:50:36
I'm debugging "xiixtasks.exe", a C# console-mode application in VS2008. I'm trying to get the version info from xiixtasks.exe. When I try "Process.GetCurrentProcess()", it gives me the filename and version info for vshost.exe, NOT xiixtasks.exe: // WRONG: this gives me xiixtasks.vhost.exe, version 9.0.30729.1 // I *want* "xiixtasks.exe", version 1.0.0.1024 System.Diagnostics.FileVersionInfo fi = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileVersionInfo; What should I be doing instead? Thank you in advance! ====================================================== Solution: 1) The

FileVersionInfo doesn't match Details tab in Explorer

主宰稳场 提交于 2019-12-01 21:06:28
问题 I'm attempting to use C# and System.Diagnostics.FileVersionInfo to extract the version information from a list of files. My purpose for doing this is to keep track of unique filepath and version combinations. When the files change I'd like various things to happen depending on what exactly changed. I've used both the FileVersion and ProductVersion properties of FileVersionInfo to no avail. Both report a different version number than what is reported in explorer. An example using explorer.exe

How to get .exe file version number from file path

﹥>﹥吖頭↗ 提交于 2019-11-28 18:31:27
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?. 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 Updated and modernized 2018 (e.g. string interpolation of C#6): The accepted answer is partly not correct (ProductVersion is not