Teamcity 9: How to add git short hash into assembly info patcher

可紊 提交于 2019-12-02 18:16:27

If you want to write this to the Assembly Info field it can be done, but it requires a separate build configuration to generate the build number. The sole purpose of this step is to create the build number that has the hash appended to it.

1. Create a build configuration to generate the short hash

2. Add a step to generate the hash

3. Add a parameter to store the hash

4. Add a second build configuration and add a dependency to the first one

5. You can now consume the parameter in the dependent step

6. At this point you can use it in the assembly info patcher

The alternative to this is to write your build number back to Git using the VCS labeling build feature.

Hope this helps.

If you mean .NET assembly you will not be able to use git's short hash as the revision number just because it accepts numbers only. You can check it yourself and put the version above to AssemblyVersion. I bet your app will not be compiled. Instead you can use %build.counter% variable from teamcity as the revision number.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!