I am having difficulty getting this to work.
I am extracting major and minor from AssemblyInfo.
I am not able to figure out how to extract the Date and run number.
I am blind because I cannot see the pipeline varables.
Thanks Andy
I have tried to create a variable named packedversion as you suggested.
I added the following task to YAML
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
# Set packversion number
$packageversion = '$(AssemblyInfo.AssemblyVersion.Major).$(AssemblyInfo.AssemblyVersion.Minor).$(Build.BuildNumber)'
echo 'packageversion: $packageversion'
Write-host "##vso[task.setvariable variable=packageversion]$packageversion"
echo 'Major: $(AssemblyInfo.AssemblyVersion.Major)'
echo 'Minor: $(AssemblyInfo.AssemblyVersion.Minor)'
echo 'buildNum: $(Build.BuildNumber)'
echo 'completed packageversion: $(packageversion)'
The results data echoed from the PowerShell is :
packageversion: $packageversion
Major: 0
Minor: 15
buildNum: 20200722.8
completed packageversion: $(packageversion)
Please point me to a description of what this syntax does
Write-host "##vso[task.setvariable variable=packageversion]$packageversion"
Then changed the nuget pack to:
- task: NuGetCommand@2
displayName: 'NuGet pack JRTestLib'
inputs:
command: pack
packagesToPack: JLReyLibrary/JRTestLib/JRTestLib.csproj
versioningScheme: byEnvVar
versionEnvVar: $(packageversion)
includeSymbols: true
toolPackage: true
enabled: true
The nuget task says it cannot fine provided environment variable.
Thanks for the help