如何拥有自动递增版本号(Visual Studio)? [重复]

本文讨论如何在Visual Studio中实现自动递增版本号。内容包括使用T4模板增加构建和修订号,通过预构建事件命令脚本以及使用第三方工具如AutoBuildVersion。此外,提到了在AssemblyInfo.cs文件中管理版本信息的方法。
摘要由CSDN通过智能技术生成

本文翻译自:How to have an auto incrementing version number (Visual Studio)? [duplicate]

This question already has an answer here: 这个问题在这里已有答案:

I want to store a set of integers that get auto incremented at build time: 我想存储一组在构建时自动递增的整数:

int MajorVersion = 0;
int MinorVersion = 1;
int Revision = 92;

When I compile, it would auto-increment Revision . 当我编译时,它会自动增加Revision When I build the setup project, it would increment MinorVersion (I'm OK with doing this manually). 当我构建安装项目时,它会增加MinorVersion (我可以手动执行此操作)。 MajorVersion would only be incremented manually. MajorVersion只会手动增加。

Then I could display a version number in menu Help/About to the user as: 然后我可以在菜单Help / About中向用户显示版本号:

Version: 0.1.92

How can this be achieved? 怎么能实现这一目标?

This question asks not only how to have an auto-incrementing version number, but also how to use that in code which is a more complete answer than others. 这个问题不仅要求如何使用自动递增版本号,还要求如何在代码中使用它,这是一个比其他更完整的答案。


#1楼

参考:https://stackoom.com/question/3T57/如何拥有自动递增版本号-Visual-Studio-重复


#2楼

This is my implementation of the T4 suggestion... This will increment the build number every time you build the project regardless of the selected configuration (ie Debug|Release), and it will increment the revisio

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值