Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
TFS 2018更新GIT存储库上的程序集信息_Git_Build_Continuous Integration_Azure Devops_Cd - Fatal编程技术网

TFS 2018更新GIT存储库上的程序集信息

TFS 2018更新GIT存储库上的程序集信息,git,build,continuous-integration,azure-devops,cd,Git,Build,Continuous Integration,Azure Devops,Cd,我希望每次推送tfs git存储库时,程序集信息文件(程序集版本)都会在构建过程中发生更改。我在构建过程中有一项任务,用于更改AssemblyInfo.cs文件,然后我还希望将此更改推送到主存储库,以便我可以从visual studio中提取更改,并查看程序集信息源文件是否也已更改 谢谢。您可以使用PowerShell任务将更新的程序集文件推送到git repo中。详情如下: 1.在更改步骤AssemblyInfo.cs后添加PowerShell任务 在更改AssemblyInfo.cs文件的任

我希望每次推送tfs git存储库时,程序集信息文件(程序集版本)都会在构建过程中发生更改。我在构建过程中有一项任务,用于更改AssemblyInfo.cs文件,然后我还希望将此更改推送到主存储库,以便我可以从visual studio中提取更改,并查看程序集信息源文件是否也已更改


谢谢。

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

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 repo中。

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