0
votes

I am using Visual Studio Team Services. The issue is with a Release definition that includes a NuGet Publisher task. I have the exact NuGet Publisher configuration working fine in a Build configuration, so I get the impression there is more to setting it up to run on Release. The error is:

Starting task: NuGet Publisher     
Set workingFolder to default: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\tasks\NuGetPublisher\0.1.39
Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\tasks\NuGetPublisher\0.1.39\NuGetPublisher.ps1
##[error]Cannot bind argument to parameter 'Path' because it is null.
##[error]Cannot bind argument to parameter 'Path' because it is null.
Check/Set nuget path

The same environment variables exist on my build profile as in the release profile. In the Release profile there is only the Nuget Publish step without the Packager step. Does this 'path' variable need to come from a packager/compile step? I wouldn't think there would be interdependencies like that.

You can reproduce this by simply creating a new build using the Visual Studio template. Then add NuGet Packager and NuGet Publisher steps just before the 'Artifacts' step. I like to output my nupkg to the $(BuildConfiguration) directory to keep things consistent. This runs fine.

Next, disable the publish step. Then make a Release profile using the Empty template. Add the NuGet Publisher step. Link to the artifact source of the Build configuration in the previous step and then release. This will result in the error.

2
The parameter 'Path' is the name of a parameter supplied to a commandlet or function in NuGetPublisher.ps1. Look in that file at what's being passed to a Path parameter. E.G. Test-Path -Path $someLocalVariableAndy Lamb
Understood. I want to keep where that value comes from consistent. I will add further reproduction notes above.AC4
As far as what can be seen in VSTS Build, a path mask is set. I am not sure what parameter that maps to. However, I set it the same between Build and Release, with Release being the only one throwing the 'Path' error.AC4

2 Answers

0
votes

The issue is in the "Nuget Publisher" task. It uses "AGENT_BUILDDIRECTORY" variable in the PowerShell script while this variable work for "Build" but not work for "Release". So the value is null in "Release". You can submit a user voice on this page: http://visualstudio.uservoice.com/forums/330519-team-services.

For now, if you are using your own build agent for "Release", you can go to your build agent work folder "agent\tasks\NuGetPublisher\0.1.39\". Update the line of blow in "VsoNuGetHelper.ps1": From:

$nuGetTempDirectory = Join-Path $Env:AGENT_BUILDDIRECTORY "NuGet\"

To:

$nuGetTempDirectory = Join-Path $Env:SYSTEM_DEFAULTWORKINGDIRECTORY "NuGet\"

With this change, the release will be finished without any error successfully.

If you are using Hosted Build agent, you can create a PowerShell script and add it to your release definition to publish the nuget package. You can refer to this code for details: https://github.com/Microsoft/vso-agent-tasks/blob/master/Tasks/NugetPublisher/NuGetPublisher.ps1

0
votes

This issue has been fixed with a recent deployment of Team Services.