BMuuN / vsts-assemblyinfo-task

Assembly Info is an extension for Azure DevOps that populates assembly information metadata from a build pipeline.
https://marketplace.visualstudio.com/items?itemName=bleddynrichards.Assembly-Info-Task
MIT License
44 stars 25 forks source link

Not setting output variables? #285

Closed andyste1 closed 1 year ago

andyste1 commented 1 year ago

I've been using your extension for a number of years in several of our builds, however I've now have hit a problem after adding it to a new collection and using it in a new build pipeline. The obvious difference is that this collection/build uses v3.2.2 of your extension while our existing builds use v2.3.105. It's also possible that I've missed something of course.

What I do in our builds is to run your task followed by a powershell task that appends your version number variable to the build number:

Write-Host ("##vso[build.updatebuildnumber]$(build.buildnumber) v$(AssemblyInfo.Version)")

Your "assembly info" task works by the way, and at the end of its log it reports the following (incidentally I don't see these lines in logs from v2.3.105):

[group]Setting output variables...

$.AssemblyInfo.Version: 1.0.8333.2 $.AssemblyInfo.FileVersion: 1.0.8333.2 $.AssemblyInfo.InformationalVersion:

[endgroup]

The above powershell task fails with this error:

========================== Starting Command Output ===========================

[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'c:\Temp\VSTS Agent_work_temp\64191260-65b3-47c2-9c69-8ab2990d0fe6.ps1'"

[error]AssemblyInfo.Version : The term 'AssemblyInfo.Version' is not recognized as the name of a cmdlet, function, script

[error]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:\Temp\VSTS Agent_work_temp\64191260-65b3-47c2-9c69-8ab2990d0fe6.ps1:4 char:52

[error]PowerShell exited with code '1'.

[section]Finishing: Append assembly version to build number

andyste1 commented 1 year ago

Apologies, I'd missed the option to specify a prefix to the output variables (defaults to "undefined"). It's working now.