【问题标题】:Initialize the build.number with the version in the AssemblyInfo.cs使用 AssemblyInfo.cs 中的版本初始化 build.number
【发布时间】:2018-03-10 00:42:12
【问题描述】:

问题

如何从 AssemblyInfo.cs 文件中读取版本并在 TeamCity 中将其设置为 %build.number%

更多信息

基本上我想在这个例子中阅读版本(2.2.0):

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("97f3f431-69a7-48c2-8bf8-7ae29075b72e")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.0")]
[assembly: AssemblyFileVersion("2.2.0")]
[assembly: NeutralResourcesLanguage("en-US")]

并将其用作我在 TeamCity 项目中的%build.number%

【问题讨论】:

  • 不是我,但我的猜测是缺乏任何研究的证据。我把这个问题放到谷歌上,得到了很多点击 - 为什么这些都不适合你?
  • @CharlesMager 大部分资源在线,展示了如何替换 AssemblyInfo 版本。我需要阅读此版本并将其设置为 teamcity 中预定义的 %build.number% 变量。
  • @CharlesMager 谢谢你回答了我的问题。

标签: c# .net teamcity teamcity-9.0 assemblyinfo


【解决方案1】:

你为什么要这样做?通常要求是相反的,即能够将%build.number% 设置为AssemblyVersionAssemblyInfo.cs。这可以使用AssemblyInfo Patcher

【讨论】:

【解决方案2】:

内部版本号应始终与程序集版本周期匹配 这样,您现在可以将哪个构建部署到生产环境中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-05-08
    • 2014-03-19
    • 2021-05-21
    • 1970-01-01
    • 1970-01-01
    • 2012-08-22
    • 1970-01-01
    相关资源
    最近更新 更多