【问题标题】:Force a specific version param when packing a nuget in TFS build在 TFS 构建中打包 nuget 时强制使用特定版本参数
【发布时间】:2017-04-18 06:20:44
【问题描述】:

我正在尝试设置 TFS 构建以使用与内部版本号指定的版本不同的版本发布 nuget 版本(我使用内部版本号格式的构建定义名称的字符串并希望保留它这样)。

我将 -version $(MajorVersion).$(MinorVersion).$(Year:yy)$(DayOfYear).$(Rev:rr) 传递给 Packager 步骤,但它失败并显示此消息:

尝试从“MyProj.Contracts.nuspec”构建包。

[error]'$(MajorVersion).$(MinorVersion).$(Year:yy)$(DayOfYear).$(Rev:rr)' is not a valid version string.
[error]Parameter name: version
[error]Unexpected exit code 1 returned from tool NuGet.exe

我怎样才能做到这一点?

【问题讨论】:

    标签: tfs continuous-integration tfsbuild azure-pipelines-build-task


    【解决方案1】:

    这些版本字符串在构建本身中不能作为变量使用。但是,如果您已将它们设为 Build.BuildNumber 值的一部分,则可以使用一点 powershell 或使用我的 VSTS Variable Toolbox 从中提取版本部分:

    然后将 $(Nuget.VersionNumber) 用于您的 Nuget 包任务。

    【讨论】:

      猜你喜欢
      • 2020-10-05
      • 1970-01-01
      • 2013-12-28
      • 2017-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-14
      • 1970-01-01
      相关资源
      最近更新 更多