1

From one of the tasks in my Azure DevOps pipeline, I will get either a single file or set of files in $(Build.SourcesDirectory) or $(Build.ArtifactStagingDirectory).

I have to check-in those files to my TFVC source control in my next task. If I am adding a Command line task, please anyone let me know what is that set of commands I have to add to that task.

Shayki Abramczyk
  • 24,285
  • 13
  • 49
  • 65
VKD
  • 219
  • 1
  • 2
  • 10
  • You probably shouldn't be doing this. What are these files and what is their purpose? Build artifacts should be pushed to a build drop or uploaded to an artifacts feed, not put back into source control. – Daniel Mann Jan 30 '20 at 14:07
  • I have Export Solution Task of PowerApps Build Tools which gives zip file. One more task which I have added after that will unpack that zip file. I want to check-in that unpacked zip file to TFVC source control – VKD Jan 31 '20 at 04:26
  • Please refer to my previous comment: Build artifacts should be pushed to a build drop or uploaded to an artifacts feed, not put back into source control. – Daniel Mann Jan 31 '20 at 04:49
  • I am not taking source from source control for build. As I told,I am taking it from power apps. So thats why i have scenario to store it in source control. – VKD Jan 31 '20 at 06:08
  • @Kattesang Did you check my answer? – Shayki Abramczyk Feb 04 '20 at 07:20

1 Answers1

0

Command scripts to Checkin files to TFVC in Azure DevOps Pipeline

Agree with Daniel, the first thing I need to make clear whether we take source from source control for build or not, storing file(s) into source control by scripts is not a recommended way. It may pollute our source code.

If you insist on doing this, then you need to be aware of the risks involved in doing this before you check into your TFVC source control.

To check-in files to TFVC source control, we could use the tf.exe in the command line, like:

"Path\TF.exe" checkin $/Path/Files/recursive

The path for TF.exe is depend on Visual Studio version and installation settings, for Visual Studio 2017:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe

You could check this thread for some more details.

Hope this helps.

Leo Liu-MSFT
  • 52,692
  • 7
  • 69
  • 81
  • When I try this command in pipeline, I am getting "TF30063: You are not authorized to access https://dev.azure.com/XXXX" error. I have tried with login attribute too. But still getting the same error. Actually I have admin access to my collections. Please let me know how to solve this error. – VKD Mar 09 '20 at 04:58
  • @Kattesang Did you enable ```Allow scripts to access oAuth token``` in the phase settings? – Alenros Feb 21 '21 at 08:31