The package we used before (Microsoft.TeamFoundationServer.ExtendedClient), doesn't support netstandard2.0
and it seems that the new REST APIs doesn't support the tasks we want to accomplish either.
So what's the recommended way to add new files as pending changes or checkout existing files in tfvc when targeting netstandard2.0
?
TF.exe
should be capable of doing the aforementioned tasks, but to get the path to it we would somehow need vsWhere.exe
and so that whole approach seems a little bit cumbersome.
CodePudding user response:
There is no, and won't be, a .NET Core compatible version of the TFVC client object model. The API used to interact with TFVC is a SOAP based API and it has never been ported to REST.
You can use vswhere to find tf.exe or build a custom .NET 4.x executable using the Client Object Model and call from your .NET Core app.
You're allowed to redistribute a copy of vswhere with your application. You can grab the latest version from here:
- powershell: |
$vswhereLatest = "https://github.com/Microsoft/vswhere/releases/latest/download/vswhere.exe"
$vswherePath = "$(Build.SourcesDirectory)\tools\vswhere.exe"
remove-item $vswherePath
invoke-webrequest $vswhereLatest -OutFile $vswherePath
test-path $vswherePath -PathType Leaf
displayName: 'Grab the latest version of vswhere.exe'
As you can see, I run this in my Azure Pipeline to inject the latest version into my build directory prior to packaging my app.
And this is the code I use do find tf.exe
afterwards:
$path = & $PSScriptRoot/vswhere.exe -latest -products * `
-requires Microsoft.VisualStudio.TeamExplorer `
-find "Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe"