在SVN中创建一个带有编号和分支名称的文件 [英] Creating a file with build number and branch name in SVN

查看:368
本文介绍了在SVN中创建一个带有编号和分支名称的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我没有一个足够的部署控制工作。虽然有一个长期计划来创建处理部署的构建脚本,我们现在只是发布我们的解决方案,然后将其复制到服务器。

There is not an enourmous amount of deployment control where I work at the moment. And while there is a long term plan to create a build script that deals with deployment at the moment we are just publishing our solutions and then copying them to the servers.

它将文本文件或类似的内容包含修订版本号和分支名称作为当前在现场系统上运行的版本的日志是非常有用的。

It would be very useful to have a text file or soemthing similar that would contain the revision number and branch name to serve as a log of which version is currently running on the live system.

可以在visual studio中使用SVN钩子或简单的后期构建脚本来实现吗?

Is it possible to do this using either SVN hooks or a simple post build script in visual studio?

推荐答案

这是一个全面细分我如何做到

Here is a full breakdown of how I did it

在您的网站根目录下创建一个名为Version.txt的空白文本文档。

Create a blank text document in the root of your website called Version.txt.

在您的网站根目录中创建一个名为Version.tmpl的第二个文本文档,其中包含以下内容

Create a second text document in the root of your website called Version.tmpl with the following contents

Revision:   $WCREV$
Repository: $WCURL$
Modified:   $WCMODS?Yes:No$
Built On:   $WCNOW$

右键点击你r网站项目并选择属性。然后转到构建事件选项卡。

Right click on your website project and choose properties. Then go to the build events tab.

将以下内容粘贴到您的后期制作活动中:

Paste the following into your post build events:

cd $(ProjectDir)
"%ProgramFiles%\TortoiseSVN\bin\SubWCRev.exe" ..\. Version.tmpl Version.txt

这将更新版本.txt文件与工作副本的一些细节,使用Version.tmpl作为模板。现在,您的网站中包含Version.txt,这意味着每次部署网站时,也会部署Version.txt,如果您需要将代码库恢复到已部署的版本,则会包含有用的信息。

This will update the Version.txt file with some details about the working copy, using Version.tmpl as the template. The fact that Version.txt is now included in your website means that every time the website is deployed the Version.txt is also deployed and will contain useful information should you ever need to get your codebase back to the deployed version.

这篇关于在SVN中创建一个带有编号和分支名称的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆