Wie lade ich PowerShell-Modul aus einem benutzerdefinierten Skript auf dem vNext-Build-Agent?

Ich verwende den Standard-Buildschritt für TFS vNext, um ein PowerShell-Skript auszuführen. Innerhalb des Skripts versuche ich, einige der Funktionen in den Standard-TFS-Agent-Modulen zu nutzen.

Hier aufgelistet:http: //blog.majcica.com/2015/11/14/available-modules-for-tfs-2015-build-tasks

Ich habe die folgenden zwei Zeilen in vielen PowerShell-Skripten gesehen, die in den Erstellungsschritten gefunden wurden:

Import-Module "Microsoft.TeamFoundation.DistributedTask.Task.Internal"
Import-Module "Microsoft.TeamFoundation.DistributedTask.Task.Common"

Ich habe versucht, die gleichen Zeilen in meinem Skript zu verwenden, jedoch erhalte ich die Fehlermeldung:

VERBOSE: Loading module from path 
'C:\TFS2015-Agent\Agent1\agent\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.Common\Microsoft.TeamFoundation.DistributedTask.Task.Common.dll'.
Import-Module : Could not load file or assembly 'Microsoft.TeamFoundation.DistributedTask.Agent.Interfaces, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. 
The system cannot find the file specified.
At C:\tfsVnBw1\3\s\Configuration\BuildScripts\CommonFunctions.ps1:25 char:5
+ Import-Module "Microsoft.TeamFoundation.DistributedTask.Task.Common" - Error ... + CategoryInfo : NotSpecified: (:) [Import-Module], FileNotFoundException + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand

Wenn ich versuche, nicht zu importieren, schreibt es etwas wie:

The 'Find-Files' command was found in the module 'Microsoft.TeamFoundation.DistributedTask.Task.Common', 
but the module could not be loaded. For more information, run 'Import-Module Microsoft.TeamFoundation.DistributedTask.Task.Common'. 
At C:\tfsVnBw1\3\s\Configuration\BuildScripts\CommonFunctions.ps1:71 char:16
+ $files = @(FindFiles $filePattern)
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Find-Files:String) [FindFiles], CommandNotFoundException + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

Ist es nicht möglich, die Module aus "normalen" PowerShell-Skripten und nicht nur aus PowerShell-Skripten zu verwenden, die als tatsächlicher Erstellungsschritt registriert wurden?

Antworten auf die Frage(4)

Ihre Antwort auf die Frage