goportable-executable

How to set the "file version" field in PE header of EXE files?


I use go build to build a exe file.Then i view the property of the file(Right click the file -> property),In detail tab,the file's version is empty.

How i to set the version of the exe file.

enter image description here


Solution

  • The EXE file version and other info are embedded as resources, which are specific to Windows and thus not supported by the Go compiler. You can use the package GoVersionInfo to accomplish this (it also supports embedding an icon). I haven't tried it myself, but it looks promising and well documented.