如何给 Visual Studio 的输出程序添加版本信息
出处:https://stackoverflow.com/questions/284258/how-do-i-set-the-version-information-for-an-existing-exe-dll
先给项目添加一个 version.h 头文件
#ifndef VERSION_H #define VERSION_H #define VER_FILEVERSION 0,3,0,0 #define VER_FILEVERSION_STR "0.3.0.0\0" #define VER_PRODUCTVERSION 0,3,0,0 #define VER_PRODUCTVERSION_STR "0.3.0.0\0" #define VER_COMPANYNAME_STR "IPanera" #define VER_FILEDESCRIPTION_STR "Localiza archivos duplicados" #define VER_INTERNALNAME_STR "MyProject" #define VER_LEGALCOPYRIGHT_STR "Copyright 2016 ipanera@gmail.com" #define VER_LEGALTRADEMARKS1_STR "All Rights Reserved" #define VER_LEGALTRADEMARKS2_STR VER_LEGALTRADEMARKS1_STR #define VER_ORIGINALFILENAME_STR "MyProject.exe" #define VER_PRODUCTNAME_STR "My project" #define VER_COMPANYDOMAIN_STR "www.myurl.com" #endif // VERSION_H
再到 proj.rc 里创建一个 Version (Add Resource)
用文字编辑器打开proj.rc
进行如下修改
#include <windows.h> #include "version.h" VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILEVERSION PRODUCTVERSION VER_PRODUCTVERSION BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904E4" BEGIN VALUE "CompanyName", VER_COMPANYNAME_STR VALUE "FileDescription", VER_FILEDESCRIPTION_STR VALUE "FileVersion", VER_FILEVERSION_STR VALUE "InternalName", VER_INTERNALNAME_STR VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR VALUE "ProductName", VER_PRODUCTNAME_STR VALUE "ProductVersion", VER_PRODUCTVERSION_STR END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1252 END END