2
votes

I'm playing with Release features in Visual Studio Online. My project is built into a nuget package that I would like to publish to a nuget feed.

I'm successfully building nuget package and publish it into Artifacts and I can see required file when I try to browse Artifacts. Then I switch into VSO Release and as part of release I have Nuget Publisher step:

VSO release screenshot

I'm using VSO internal nuget feed with address like this:

https://mytenant.pkgs.visualstudio.com/DefaultCollection/_packaging/myfeedname/nuget/v3/index.json

When I create new release this step fails:

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 Creating Nuget Arguments 
[error]Cannot bind argument to parameter 'Path' because it is null. 
[error]You cannot call a method on a null-valued expression.

Obviously nuget file path is not being passed to the script. Also I have tried to specify exact path to the nuget (selected from dropdowns):

$(System.DefaultWorkingDirectory)\Build & Test\nuget package\MyPackageName.1.1.16014.7.nupkg

But got the same error.

This step only fails when I use it in VSO Release. When I use Nuget Publisher step as a build step and specify same nuget feed address and "Path/Pattern to nupkg" as **\bin\MyPackageName.*.nupkg, I get the package published to the feed.

Any idea how to fix this error for VSO Release?

UPD: this is the log debug output

>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
>[debug]Importing modules
>[debug]Loading module from path 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.Internal\Microsoft.TeamFoundation.DistributedTask.Task.Internal.dll'.
>[debug]Importing cmdlet 'Add-BuildAttachment'.
>[debug]Importing cmdlet 'Convert-String'.
>
>...SNIP...
>
>[debug]Importing cmdlet 'Find-Files'.
>[error]System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'Path' because it is null.
>[error]   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)
>[error]   at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
>[error]   at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
>[error]   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
>[error]   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
>[error]System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'Path' because it is null.
>[error]   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)
>[error]   at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
>[error]   at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
>[error]   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
>[error]   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
>[debug]Entering script System.Management.Automation.InvocationInfo.MyCommand.Name
>[debug]Parameter Values
>[debug]searchPattern = C:\a\0dbc15949\**\*.nupkg
>[debug]nuGetFeedType = internal
>[debug]connectedServiceName = 
>[debug]feedName = https://MyName.pkgs.visualstudio.com/DefaultCollection/_packaging/MyFeedName/nuget/v3/index.json
>[debug]nuGetAdditionalArgs = 
>[debug]nuGetPath = 
>Check/Set nuget path
>Creating Nuget Arguments
>[debug]Using provided feed URL
>[error]System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'Path' because it is null.
>[error]   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)
>[error]   at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
>[error]   at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
>[error]   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
>[error]   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

Here is the full log for Nuget Publisher step

1
Add the system.debug variable to your RM environment and set it to true. This should give you some further insight as to where the problem is actually occurring as it will turn verbose debugging messages on in the NugetPackage task. It seems like it's having trouble with the path to nuget.exe itself rather than your package.d3r3kk
@d3r3kk good shout. I've added debug variable to build steps, but never realised release steps have their own variables. See update to the question. Not much clearer now - either there is no path to nuget.exe. Or to the package file.trailmax

1 Answers

4
votes

This was a bug in the NuGet Publisher task. It was fixed with our Sprint 94 deployment.