TeamCity - AssemblyInfo Patcher 中的动态参数
TeamCity - Dynamic Parameter in AssemblyInfo Patcher
我的构建有一个自定义构建步骤,该步骤从存储库中读取文本文件并写入 build.version 配置参数。我正在尝试在这样的 AssemblyInfo 修补程序中使用该值:%build.version%.%system.build.number%.
构建一直失败并出现类似于以下内容的错误:
error CS0647: Error emitting 'System.Reflection.AssemblyVersionAttribute' attribute -- 'The version specified '.26' is invalid'
构建运行后,我可以在“参数”选项卡中看到 build.version 设置为正确的值。
我是不是做错了什么或者有更好的方法来完成这个?
更新:
我现在在构建日志中看到 AssemblyInfo 修补程序在我设置值的第一个构建步骤之前是 运行。有什么方法可以将它延迟到第一个构建步骤之后吗?
来自 TeamCity documentation:
Configuration parameters (no prefix) are not passed into the build and are only meant to share settings within a build configuration. They are the primary means for customizing a build configuration which is based on a template or uses a meta-runner .
相反,您应该使用系统属性(在构建参数选项卡上定义)。您甚至可以将配置参数作为值提供给系统 属性.
在 TeamCity 中似乎没有解决此问题的方法。它总是在第一个构建步骤之前运行 AssemblyInfo 修补程序。
我最终使用 Rake 和 Albacore 编写我的构建脚本解决了这个问题。这让我可以自己设置我的版本控制,而且还有一个很好的副作用,那就是让我可以在 运行 之前在 TeamCity 中测试我的构建。
另一种选择是在单独的 parent 构建中生成动态内部版本号,然后通过快照依赖项使用该内部版本号。将 child 的内部版本号设置为 %dep.PARENT_BUILD_ID.build.number%。这样,在 AssemblyInfo Patcher 运行时已经定义了内部版本号。有关详细信息,请参阅
我的构建有一个自定义构建步骤,该步骤从存储库中读取文本文件并写入 build.version 配置参数。我正在尝试在这样的 AssemblyInfo 修补程序中使用该值:%build.version%.%system.build.number%.
构建一直失败并出现类似于以下内容的错误:
error CS0647: Error emitting 'System.Reflection.AssemblyVersionAttribute' attribute -- 'The version specified '.26' is invalid'
构建运行后,我可以在“参数”选项卡中看到 build.version 设置为正确的值。
我是不是做错了什么或者有更好的方法来完成这个?
更新: 我现在在构建日志中看到 AssemblyInfo 修补程序在我设置值的第一个构建步骤之前是 运行。有什么方法可以将它延迟到第一个构建步骤之后吗?
来自 TeamCity documentation:
Configuration parameters (no prefix) are not passed into the build and are only meant to share settings within a build configuration. They are the primary means for customizing a build configuration which is based on a template or uses a meta-runner .
相反,您应该使用系统属性(在构建参数选项卡上定义)。您甚至可以将配置参数作为值提供给系统 属性.
在 TeamCity 中似乎没有解决此问题的方法。它总是在第一个构建步骤之前运行 AssemblyInfo 修补程序。
我最终使用 Rake 和 Albacore 编写我的构建脚本解决了这个问题。这让我可以自己设置我的版本控制,而且还有一个很好的副作用,那就是让我可以在 运行 之前在 TeamCity 中测试我的构建。
另一种选择是在单独的 parent 构建中生成动态内部版本号,然后通过快照依赖项使用该内部版本号。将 child 的内部版本号设置为 %dep.PARENT_BUILD_ID.build.number%。这样,在 AssemblyInfo Patcher 运行时已经定义了内部版本号。有关详细信息,请参阅