版本号控制的想法

发布于 2024-09-06 17:01:43 字数 491 浏览 4 评论 0原文

以下是我们正在研究的开发环境:

  1. 主要是 .NET(主要是 C#)
  2. 在 Visual Studio 2008 中进行开发
  3. SVN 中的源代码控制(VisualSVN 服务器、Tortoise 客户端)
  4. 使用由 Rake 脚本控制的 MSBuild/MSDeploy 进行部署

我们想要开始拥有什么是对部署中版本号的某种跟踪。这里的主要原因是非开发人员能够查看生产系统上的某些内容,并至少知道是什么源代码控制版本生成了它,跟踪我们的票务系统中的版本号等。

我的第一个想法是标记每个程序集在构建时(我想是通过 Rake 脚本)使用 Major.Minor.Build 版本号方案。我们可以在Rake脚本中手动设置Major和Minor,这些不会经常改变,并使用当前的SVN修订号作为Build。

有更好的方法吗?从旧主干版本的标签构建版本号是否会变得混乱?对此事有什么想法或建议吗?也许某个地方已经有一个工具可以很好地做到这一点?

Here's the development environment we're looking at:

  1. Primarily .NET (C# mostly)
  2. Development in Visual Studio 2008
  3. Source control in SVN (VisualSVN server, Tortoise client)
  4. Deployments with MSBuild/MSDeploy controlled by Rake scripts

What we'd like to start having is some kind of tracking of version numbers in deployments. The main reasoning here is for a non-developer to be able to look at something on the Production systems and know at least what source control revision produced it, track version numbers in our ticketing system, etc.

My first thought is to stamp every assembly at build time (via the Rake script, I would imagine) with a Major.Minor.Build version number scheme. We can manually set Major and Minor in the Rake script, those won't often change, and use the current SVN revision number as the Build.

Is there a better way to do this? Will the Build number get muddled by building from a tag of an older trunk revision? Any thoughts or advice on the matter? Maybe there's a tool somewhere that already does this rather well?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风柔一江水 2024-09-13 17:01:43

由于您已经在构建中使用了 rake,我想指出 Albacore 框架,它使得在构建时对程序集进行版本控制变得非常容易。

http://github.com/derickbailey/Albacore

我们为 rake 提供了一个“assembleinfo”任务,允许您可以指定所需的任何程序集级别属性 - c# 或 vb.net。例如:

desc "Run a sample assembly info generator"
assemblyinfo :assemblyinfo do |asm|
  asm.version = "0.1.2.3"
  asm.company_name = "a test company"
  asm.product_name = "a product name goes here"
  asm.title = "my assembly title"
  asm.description = "this is the assembly description"
  asm.copyright = "copyright some year, by some legal entity"
  asm.custom_attributes :SomeAttribute => "some value goes here", :AnotherAttribute => "with some data"
  asm.output_file = "lib/spec/support/AssemblyInfo/AssemblyInfo.cs"
end

您可以在其中看到 asm.version,设置版本号。使用变量来设置它而不是硬编码的字符串值非常容易。

asm.version = "1.2.3.#{svnrevision}"

还有一个 msbuild 任务,它使调用 msbuild 变得非常容易,此外还有大约 20 个任务。请参阅 github 上的 wiki 页面以获取完整列表。

有关 albacore 的更多信息,请参阅以下资源:

since you're already using rake for your builds, i'd like to point out the Albacore framework which makes versioning your assemblies at build time really easy.

http://github.com/derickbailey/Albacore

we provide an "assemblyinfo" task for rake that allows you to specify any assembly level attributes that you want - c# or vb.net. for example:

desc "Run a sample assembly info generator"
assemblyinfo :assemblyinfo do |asm|
  asm.version = "0.1.2.3"
  asm.company_name = "a test company"
  asm.product_name = "a product name goes here"
  asm.title = "my assembly title"
  asm.description = "this is the assembly description"
  asm.copyright = "copyright some year, by some legal entity"
  asm.custom_attributes :SomeAttribute => "some value goes here", :AnotherAttribute => "with some data"
  asm.output_file = "lib/spec/support/AssemblyInfo/AssemblyInfo.cs"
end

you can see the asm.version in there, setting the version #. it would be really easy to use a variable to set this instead of a hard coded string value.

asm.version = "1.2.3.#{svnrevision}"

there is also an msbuild task which makes calling msbuild really easy, and about 20 more beyond that. see the wiki page on github for a complete list.

for more info on albacore, see these resources:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文