如何增加之后每 VisualC++ 中生成版本信息
2008-02-22 16:05
316 查看
function loadTOCNode(){}
转自MSDN :http://support.microsoft.com/kb/237870/zh-cn
VisualC++ 不具备功能来自动增加版本资源信息项目的各个生成后。 本文介绍一个地提供这些功能。
回到顶端
您可以编写程序来修改资源编译器 (.rc) 文件而不是使用这里介绍步骤。 但是, RC 文件是个 VisualC++ 控制下。 VisualC++ 修改同时保存, RC 文件并可能会影响版本资源。 本节中介绍方法可应用于任何 VisualC++ 项目。 本示例使用 Microsoft 基础类项目。
创建新项目使用 MFC (EXE) Appwizard 并调用它 MyProject . MyProject 将有一个 MyProject.rc 文件, 包括 MyProject.rc2。 .rc 2 文件是用于用户定义资源。 请按照下列步骤来增加每生成后 MyProject 的版本信息:
转自MSDN :http://support.microsoft.com/kb/237870/zh-cn
概要
loadTOCNode(1, 'summary');VisualC++ 不具备功能来自动增加版本资源信息项目的各个生成后。 本文介绍一个地提供这些功能。
回到顶端
更多信息
loadTOCNode(1, 'moreinformation');您可以编写程序来修改资源编译器 (.rc) 文件而不是使用这里介绍步骤。 但是, RC 文件是个 VisualC++ 控制下。 VisualC++ 修改同时保存, RC 文件并可能会影响版本资源。 本节中介绍方法可应用于任何 VisualC++ 项目。 本示例使用 Microsoft 基础类项目。
创建新项目使用 MFC (EXE) Appwizard 并调用它 MyProject . MyProject 将有一个 MyProject.rc 文件, 包括 MyProject.rc2。 .rc 2 文件是用于用户定义资源。 请按照下列步骤来增加每生成后 MyProject 的版本信息:
1. | Remove the version resource from the .rc file and place it in the .rc2 file:
| ||||||
2. | Replace the FILEVERSION and PRODUCTVERSION data with macros FILEVER and PRODUCTVER. Similarly, replace the FileVersion and ProductVersion string data with the macros STRFILEVER and STRPRODUCTVER. | ||||||
3. | Add a #include VersionNo.h immediately before the VS_VERSION_INFO resource statement. Now the version resource will look like://///////////////////////////////////////////////////////////////////// // // Version // #include "VersionNo.h" VS_VERSION_INFO VERSIONINFO FILEVERSION FILEVER PRODUCTVERSION PRODUCTVER FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x1L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "Comments", "Sample Application/0" VALUE "CompanyName", "Microsoft Corp./0" VALUE "FileDescription", "MyProject MFC Application/0" VALUE "FileVersion", STRFILEVER VALUE "InternalName", "MyProject/0" VALUE "LegalCopyright", "Copyright (C) 1997/0" VALUE "OriginalFilename", "MyProject.EXE/0" VALUE "ProductName", "MyProject Application/0" VALUE "ProductVersion", STRPRODUCTVER END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END | ||||||
4. | Create a header file called VersionNo.h in the same directory as your project. This file will contain the following statements, which are the definitions for macros used in step 2: #define FILEVER 1,0,0,1 #define PRODUCTVER 1,0,0,1 #define STRFILEVER "1, 0, 0, 1/0" #define STRPRODUCTVER "1, 0, 0, 1/0" NOTE: Add linefeed and carriage return characters on the last line. Now, MyProject.rc file includes MyProject.rc2, and MyProject.rc2 file includes VersionNo.h. | ||||||
5. | The VersionNo.h file contents will be modified using a Visual Basic Script macro. The macro described below handles the Visual C++ BuildFinish event, so it will not be fired until a build completes. Whenever this VB Script code is called, it first increments the version numbers inside the header file by a fixed amount, then it saves the file and closes it. During a subsequent build, the new version number is included in the executable. To install and use the VB Script code, do the following:
| ||||||
6. | Select Build MyProject.exe from the Build menu. After the build finishes, open the VersionNo.h file. It will contain the following statements: #define FILEVER 1,0,0,2 #define PRODUCTVER 1,0,0,2 #define STRFILEVER "1, 0, 0, 2/0" #define STRPRODUCTVER "1, 0, 0, 2/0" If you build the code again, this version information in included in the executable, and the version information is incremented. You can introduce some code in the macro described earlier to prevent incrementing version numbers if the build produced errors. |
相关文章推荐
- 如何增加在 Visual C++ 中的每个生成后的版本信息
- [版本构造]给delphi生成的软件增加版本信息 续---编译乱码问题解决
- 如何给VC之Win32生成的.exe文件添加版本信息
- 如何增加后每个版本的 Visual c + + 版本信息
- [版本构造]给delphi生成的软件增加版本信息
- 如何增量后 Visual C++ 中的每个生成的版本信息
- cocos2dx2.2版本之后,如何生成项目工程
- Android 版本信息如何查看
- 如何查看linux发行版版本信息
- 市内移出版本2.0(1、一页显示15条。2、增加控制标志。3、打印表格时绑定的list的优化。4、保存迁出登记信息时根据业务流水号判断增加还是修改。5、统一管理常量)
- tomcat注册成windows系统服务之后,如何增加 security 安全参数
- 如何使用VC6编译sqlite3源码生成动态链接库(版本:sqlite-source-3_6_23_1)
- 通过poi获取到了商店的地理位置之后,如何获取商店的详细信息。是需要商店提供还是地图提供
- (转)iOS如何取得APP的版本信息跟服务器对比进行升级提示?
- 如何查看 ubuntu 版本信息
- Ubuntu下如何查看GPU版本和使用信息?
- 团队基础生成自动化流程之最佳实践总论(II) – 程序集版本信息
- Linux下如何查看版本信息
- Linux下如何查看版本信息
- 如何查看Linux版本信息