简体   繁体   English

发布期间增加版本并签入Team Foundation Server(TFS)

[英]Increment version during publishing and check in to Team Foundation Server (TFS)

I am at present setting up my ASP.NET MVC 4 web application with publish profiles and the associated publishing features. 我目前正在使用发布配置文件和相关的发布功能设置我的ASP.NET MVC 4 Web应用程序。 My continuous integration (CI) environment is Team Foundation Server (TFS) build 2010 and TFS for source control. 我的持续集成 (CI)环境是Team Foundation Server (TFS)build 2010和TFS for source control。

I have a number of requirements that I would like to achieve with this. 我有很多要求,我想用这个来实现。 Firstly, each time I create the publish package for release, I would like the build number to be incremented and revision number reset to 0 in my version file. 首先,每次我为发布创建发布包时,我希望在我的版本文件中增加内部版本号并将版本号重置为0。 I currently have one version file that contains the version number of Major.Minor.Build.Revision . 我目前有一个版本文件,其中包含Major.Minor.Build.Revision的版本Major.Minor.Build.Revision So I would like the creation of the publishing package to do such. 所以我希望创建发布包来做到这一点。 Is this possible and if so how is it achieved? 这是可能的,如果是这样,它是如何实现的? Note as this increments the version file, as part of this process I would like this checked in to source control. 请注意,这会增加版本文件,作为此过程的一部分,我希望将其签入源代码控制。

My second question is that each time a developer checks in to the TFS build server, the revision number will get incremented or at least changed to a new value. 我的第二个问题是,每次开发人员签入TFS构建服务器时,修订号都会增加或至少更改为新值。 I had hoped to update my build template to achieve this, but unfortunately due to restrictions on my build server I can not incorporate any custom activities on it. 我本来希望更新我的构建模板来实现这一点,但不幸的是由于我的构建服务器的限制,我不能在其上包含任何自定义活动。 So I am looking to perform this task with MSBuild . 所以我希望用MSBuild执行此任务。 Is it possible to achieve what I outlined here with MSBuild and if so, could I get an explanation please? 是否有可能实现我在MSBuild中概述的内容,如果是这样,我能得到解释吗?

这是一篇旧的博客文章,但它可能仍然有效: 如何:使用MSBuild更新程序集版本号

The Team Foundation Build Customization Guide has 10 pages on this topic (a little too much to duplicate here). Team Foundation Build Customization Guide有10个关于此主题的页面(这里有点太多了,无法复制)。 This guide is produced by the Visual Studio ALM Rangers and is about as close as you can get to official guidance. 本指南由Visual Studio ALM Rangers制作,并且尽可能接近官方指导。

Look at these Stack Overflow answers to Working automatic build increment Visual Studio addin and Auto update version numbers (C++ / C#) in Visual Studio 2005 . 查看Visual Studio 2005中的 工作自动构建增量Visual Studio插件自动更新版本号(C ++ / C#)的这些Stack Overflow答案。

I hope you'll find the solution. 我希望你能找到解决方案。 ProjectBuildCounter is an independent stand alone that might be attached to a project as well as a TFS event handler. ProjectBuildCounter是一个独立的独立站点,可能附加到项目以及TFS事件处理程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM