【问题标题】:TFS 2018 Update Assembly Info on GIT RepositoryTFS 2018 更新 GIT 存储库上的程序集信息
【发布时间】:2019-01-07 15:02:17
【问题描述】:

我希望每次推送到 tfs git 存储库时,Assembly Info 文件(Assembly 版本)都会在构建过程中发生变化。我有一个关于更改 AssemblyInfo.cs 文件的构建过程的任务,然后我还想将此更改推送到主存储库,以便我可以从 Visual Studio 中提取更改并查看 Assembly Info 源文件也已更改.

谢谢。

【问题讨论】:

  • 这不是问题。你尝试了什么?你有什么问题?
  • 终极目标是什么?只更新 AssemblyInfo.cs 文件?为什么不直接更新它并将更改推送到 Git 存储库?

标签: git build continuous-integration azure-devops cd


【解决方案1】:

您可以使用 PowerShell 任务 将更新的程序集文件推送到 git 存储库中。详情如下:

1。更改步骤AssemblyInfo.cs后添加PowerShell任务

在更改AssemblyInfo.cs 文件的任务之后,添加版本为 2.*(预览)的 PowerShell 任务。

2。通过 PowerShell 脚本提交更改推送到 TFS git repo

使用如下脚本提交和推送更改:

$branch="$(Build.SourceBranch)".replace("refs/heads/","")
git add .  # Or use "git add /path/to/AssemblyInfo.cs" instead
git commit -m 'commit changes for AssemblyInfo.cs file'
git push origin HEAD:$branch

现在,在每次构建之后,更新的 AssemblyInfo.cs 文件将被推送到 TFS git 存储库中。

【讨论】:

    猜你喜欢
    • 2014-09-02
    • 2021-02-22
    • 2017-03-07
    • 2020-02-07
    • 2013-02-23
    • 2012-10-19
    • 1970-01-01
    • 2020-12-09
    • 2018-08-13
    相关资源
    最近更新 更多