所以我终于掌握了TFS,用一些测试(NUnit)构建了一个小应用程序,并希望让TFS为我构建它。 但是,当它尝试使用NuGet时,构建失败:
******************************************************************************
Starting: Build
******************************************************************************
Executing the following commandline:
C:\Users\rab\Desktop\BuildAgent\agent\worker\vsoWorker.exe /name:Worker-6726df74-da4c-466a-b1c6-1f2b78b88a8d /id:6726df74-da4c-466a-b1c6-1f2b78b88a8d /rootFolder:"C:\Users\rab\Desktop\BuildAgent" /logger:Forwarding,1.0.0;Verbosity=Verbose,Name=Agent4-bbf8df0bd72035f895b9972ec79f2bcb;JobId=6726df74-da4c-466a-b1c6-1f2b78b88a8d
******************************************************************************
Starting: Get sources
******************************************************************************
Syncing repository: RABs Git test (Git)
Starting fetch...
Checking out 1f6c87dfd38578b9d0f365f83a92fc4ef9bc172e to C:\Users\rab\Desktop\BuildAgent\_work\1\s
Checked out branch refs/heads/master for repository RABs Git test at commit 1f6c87dfd38578b9d0f365f83a92fc4ef9bc172e
******************************************************************************
Running tasks
******************************************************************************
******************************************************************************
Starting task: NuGet restore GitDemoProject.sln
******************************************************************************
Set workingFolder to default: C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18
Executing the powershell script: C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18\NuGetInstaller.ps1
Attempting to perform the NormalizeRelativePath operation on the 'FileSystem' provider failed for path 'C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18'. Access is denied
******************************************************************************
Finishing task: NuGetInstaller
******************************************************************************
******************************************************************************
Starting task: Copy Files to: $(build.artifactstagingdirectory)
******************************************************************************
Set workingFolder to default: C:\Users\rab\Desktop\BuildAgent\tasks\CopyFiles\1.0.13
fs.js:887
return binding.lstat(pathModule._makeLong(path));
^
Error: EPERM: operation not permitted, lstat 'C:\Users\rab'
at Error (native)
at Object.fs.lstatSync (fs.js:887:18)
at Object.realpathSync (fs.js:1518:21)
at toRealPath (module.js:126:13)
at Function.Module._findPath (module.js:165:20)
at Function.Module._resolveFilename (module.js:337:25)
at Function.Module._load (module.js:290:25)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:146:18)
at node.js:404:3
******************************************************************************
Finishing task: CopyFiles
******************************************************************************
******************************************************************************
Starting task: Publish Artifact: drop
******************************************************************************
Set workingFolder to default: C:\Users\rab\Desktop\BuildAgent\tasks\PublishBuildArtifacts\1.0.28
fs.js:887
return binding.lstat(pathModule._makeLong(path));
^
Error: EPERM: operation not permitted, lstat 'C:\Users\rab'
at Error (native)
at Object.fs.lstatSync (fs.js:887:18)
at Object.realpathSync (fs.js:1518:21)
at toRealPath (module.js:126:13)
at Function.Module._findPath (module.js:165:20)
at Function.Module._resolveFilename (module.js:337:25)
at Function.Module._load (module.js:290:25)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:146:18)
at node.js:404:3
******************************************************************************
Finishing task: PublishBuildArtifacts
******************************************************************************
Task NuGetInstaller failed. This caused the job to fail. Look at the logs for the task for more details.
******************************************************************************
Finishing Build
******************************************************************************
行Attempting to perform the NormalizeRelativePath operation on the 'FileSystem' provider failed for path 'C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18'. Access is denied
给出了第一击。
我试图运行它,这也带来了很多错误:
PS C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18> .\NuGetInstaller.ps1
import-module : The specified module 'Microsoft.TeamFoundation.DistributedTask.Task.Internal' was not loaded because no
valid module file was found in any module directory.
At C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18\NuGetInstaller.ps1:12 char:1
+ import-module "Microsoft.TeamFoundation.DistributedTask.Task.Internal"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (Microsoft.TeamF...k.Task.Internal:String) [Import-Module], FileNot
FoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
import-module : The specified module 'Microsoft.TeamFoundation.DistributedTask.Task.Common' was not loaded because no v
alid module file was found in any module directory.
At C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18\NuGetInstaller.ps1:13 char:1
+ import-module "Microsoft.TeamFoundation.DistributedTask.Task.Common"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (Microsoft.TeamF...ask.Task.Common:String) [Import-Module], FileNot
FoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18\VsoNuGetHelper.ps1:3 char:33
+ $nuGetTempDirectory = Join-Path $Env:SYSTEM_ARTIFACTSDIRECTORY "NuGet\"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCom
mand
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18\VsoNuGetHelper.ps1:4 char:34
+ $tempNuGetConfigPath = Join-Path $nuGetTempDirectory "newNuGet.config"
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCom
mand
Get-LocalizedString : The term 'Get-LocalizedString' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18\NuGetInstaller.ps1:26 char:12
+ throw (Get-LocalizedString -Key "Solution parameter must be set")
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-LocalizedString:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Convert-String : The term 'Convert-String' is not recognized as the name of a cmdlet, function, script file, or operabl
e program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18\NuGetInstaller.ps1:29 char:21
+ $b_excludeVersion = Convert-String $excludeVersion Boolean
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Convert-String:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Convert-String : The term 'Convert-String' is not recognized as the name of a cmdlet, function, script file, or operabl
e program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18\NuGetInstaller.ps1:30 char:14
+ $b_noCache = Convert-String $noCache Boolean
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Convert-String:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Get-LocalizedString : The term 'Get-LocalizedString' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18\NuGetInstaller.ps1:54 char:12
+ throw (Get-LocalizedString -Key "No solution was found using search pattern ...
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-LocalizedString:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Get-ToolPath : The term 'Get-ToolPath' is not recognized as the name of a cmdlet, function, script file, or operable pr
ogram. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18\NuGetInstaller.ps1:65 char:18
+ $nuGetPath = Get-ToolPath -Name 'NuGet.exe';
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-ToolPath:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Get-LocalizedString : The term 'Get-LocalizedString' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18\NuGetInstaller.ps1:70 char:12
+ throw (Get-LocalizedString -Key "Unable to locate {0}" -ArgumentList 'nuget. ...
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-LocalizedString:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\rab\Desktop\BuildAgent\tasks\NuGetInstaller\0.1.18>
答案 0 :(得分:1)
回答found here,但我不确切知道为什么这是解决方案。
将代理文件夹(包含Agent
,task
,ConfigureAgent.cmd
...)移至c:\SomeName
,您就可以了。