带有$(GitVersion.NuGetVersion)的标签源使用变量名称而不是值创建标记

在成功构建之后,将标签格式配置为$(
GitVersion.NuGetVersion),结果标记设置为$(GitVersion.NuGetVersion)而不是该变量的实际扩展值.

在构建输出日志记录中,有2个部分/计划:Build和Finalize Build.

据推测,一旦构建代理移动到第二部分/计划,所有变量上下文/状态就会丢失.

如果在Finalize Build部分期间GitVersion变量的上下文丢失,我应该如何使用生成的GitVersion标记源?

https://github.com/Microsoft/vsts-agent/issues/716

最佳答案 我在
issue on GitHub回答了你的问题:

I don’t think there is anything we can do inside of the GitVersion task about this as long as VSTS doesn’t provide an appropriate API. GitVersion currently just defines the variables using the 07001. Variables are explicitely defined in the task context, and therefor available for subsequent tasks, but not outside of the context.

A special case is the build number for which a special command exists 07002 which we are using.

A workaround can be to add an additional task which adds the tag, which will work since the task will be in the same context and have therefore access to the variable.

点赞