chocolatey-community / chocolatey-azuredevops

Chocolatey Extension for Azure DevOps
MIT License
21 stars 11 forks source link

Set Build Variables As Environment Variables #47

Open sheldonhull opened 5 years ago

sheldonhull commented 5 years ago

When packaging a nuget package, I'm allowing the version number to be set. I would like the full path for this nupkg file that is created with a version number to be set as an build variable so it's accessible in further steps like Push. Right now I'm not seeing any mention of setting variables, so I'm not able to specific the exact package name to push on a separate push step.

gep13 commented 5 years ago

@sheldonhull off the top of my head, I am not sure how this would be possible. Can you help with providing some detailed steps, perhaps with some screenshots, of how you are doing this with the NuGet Task, and I can look into how this can be achieved within the Chocolatey Task as well.

sheldonhull commented 5 years ago

When you create the package, get the package name get-childitem or something like that if it's not an output from the pack command. Then use VSO command to set as variable that is available in next tasks.

This exact syntax should work:

Write-Host "##vso[task.setvariable variable=ChocoPackageName;]$NupkgFullPath"

Further documentation

Hopefully that helps. I got around this by using folder, but this would still be a nice enhancement.