Available modules for TFS 2015 build tasks
It is not yet well documented but if you are writing a custom build task for your TFS 2015 build system, you get at your disposition some of the modules that are made available by your VsoWorker.
As I couldn’t find a list of available modules and cmdlets they expose, I decided to dig into them and see what is there. I also wanted to check if with the Update 1 (and the new version of the build agent) there will be more of them.
I wrote a handy task that will list all of the available cmdlets for all of the modules shipped by the agent worker. Following are my results.
With TFS 2015 the agent version delivered is 1.83.2. It offers the following modules:
- Microsoft.TeamFoundation.DistributedTask.Task.Common.dll
- Microsoft.TeamFoundation.DistributedTask.Task.Deployment.Azure.psm1
- Microsoft.TeamFoundation.DistributedTask.Task.Deployment.Chef.psm1
- Microsoft.TeamFoundation.DistributedTask.Task.DevTestLabs.dll
- Microsoft.TeamFoundation.DistributedTask.Task.DTA.dll
- Microsoft.TeamFoundation.DistributedTask.Task.Internal.dll
- Microsoft.TeamFoundation.DistributedTask.Task.TestResults.dll
I will now list of all importable functions and cmdlets in those modules.
- Microsoft.TeamFoundation.DistributedTask.Task.Common.dll
- Add-TaskIssue
- Complete-Task
- Find-Files
- Get-LocalizedString
- Set-TaskProgress
- Set-TaskVariable
- Write-TaskDetail
- Microsoft.TeamFoundation.DistributedTask.Task.Deployment.Azure.psm1
- Get-AzureCmdletsVersion
- Get-AzureModuleLocation
- Get-AzureVersionComparison
- Get-RequiresEnvironmentParameter
- Get-SelectNotRequiringDefault
- Import-AzurePowerShellModule
- Initialize-AzurePowerShellSupport
- Initialize-AzureSubscription
- Microsoft.TeamFoundation.DistributedTask.Task.Deployment.Chef.psm1
- Get-DetailedRunHistory
- Get-PathToNewtonsoftBinary
- Get-ShouldWaitForNodeRuns
- Get-TemporaryDirectoryForChef
- Initialize-ChefRepo
- Invoke-GenericMethod
- Invoke-Knife
- Invoke-WithRetry
- Wait-ForChefNodeRunsToComplete
- Microsoft.TeamFoundation.DistributedTask.Task.DevTestLabs.dll
- Complete-EnvironmentOperation
- Complete-EnvironmentResourceOperation
- Complete-ResourceOperation
- Copy-FilesToAzureBlob
- Copy-FilesToRemote
- Copy-FilesToTargetMachine
- Copy-ToAzureMachines
- Get-Environment
- Get-EnvironmentProperty
- Get-EnvironmentResources
- Get-ProviderData
- Invoke-BlockEnvironment
- Invoke-EnvironmentOperation
- Invoke-PsOnRemote
- Invoke-ResourceOperation
- Invoke-UnblockEnvironment
- New-OperationLog
- Register-Environment
- Register-EnvironmentDefinition
- Register-Provider
- Register-ProviderData
- Remove-Environment
- Remove-EnvironmentResources
- Microsoft.TeamFoundation.DistributedTask.Task.DTA.dll
- Invoke-DeployTestAgent
- Invoke-RunDistributedTests
- Microsoft.TeamFoundation.DistributedTask.Task.Internal.dll
- Add-BuildArtifactLink
- Add-BuildAttachment
- Convert-String
- Copy-BuildArtifact
- Get-JavaDevelopmentKitPath
- Get-MSBuildLocation
- Get-ServiceEndpoint
- Get-TaskVariable
- Get-ToolPath
- Get-VisualStudioPath
- Get-VssConnection
- Get-X509Certificate
- Invoke-Ant
- Invoke-BatchScript
- Invoke-IndexSources
- Invoke-Maven
- Invoke-MSBuild
- Invoke-PublishSymbols
- Invoke-Tool
- Invoke-VSTest
- Publish-BuildArtifact
- Register-XamarinLicense
- Unregister-XamarinLicense
- Microsoft.TeamFoundation.DistributedTask.Task.TestResults.dll
- Invoke-ResultPublisher
- Publish-TestResults
The Update 1 RC1 for TFS increased the agent to the version 1.89.0 and the RC2 incremented it to version 1.89.1. As of the time I’m writing this blog post, the RC2 is the latest version available, I’ll list and show the differences with a plain TFS 2015 build agent.
Three new modules are added:
- Microsoft.TeamFoundation.DistributedTask.Task.CodeCoverage
- Microsoft.TeamFoundation.DistributedTask.Task.Deployment.Internal
- Microsoft.TeamFoundation.DistributedTask.Task.Deployment.RemoteDeployment
Following the list of all importable functions and cmdlets in the those modules.
- Microsoft.TeamFoundation.DistributedTask.Task.CodeCoverage
- Enable-CodeCoverage
- Publish-CodeCoverage
- Microsoft.TeamFoundation.DistributedTask.Task.Deployment.Internal
- Get-OperationLogs
- Get-ResourceCredentials
- Get-ResourceFQDNTagKey
- Get-ResourceHttpsTagKey
- Get-ResourceHttpTagKey
- Get-ResourceOperationLogs
- Get-SkipCACheckTagKey
- Get-SqlPackageCommandArguments
- Import-DevtestLabsCommomDll
- Write-ResponseLogs
- Microsoft.TeamFoundation.DistributedTask.Task.Deployment.RemoteDeployment
- Invoke-RemoteDeployment
Furthermore some cmdlets are added to the existing modules:
- Microsoft.TeamFoundation.DistributedTask.Task.Deployment.Azure.psm1
- Set-CurrentAzureRMSubscription
- Set-CurrentAzureSubscription
- Microsoft.TeamFoundation.DistributedTask.Task.DevTestLabs.dll
- Get-ExternalIpAddress
- Get-ParsedSessionVariables
- Microsoft.TeamFoundation.DistributedTask.Task.Internal.dll
- Get-IndexedSourceFilePaths
- Get-TfsClientCredentials
It also seems that in the Microsoft.TeamFoundation.DistributedTask.Task.Internal.dll, Invoke-IndexSources cmdlet is not available any more.
You can reference these modules from your custom Build tasks by calling a standard import module cmdlet.
import-module "Microsoft.TeamFoundation.DistributedTask.Task.Common"
If you are interested about the agent version, you can check it by executing the vsoagent on your build server, with the following parameter:
VsoAgent.exe /version
As soon as an RTM version of the Update 1 becomes available, I’ll update this post.
In case you are interested in a short description of these functions, you can their source code for further info