Currently, I have *.yaml variables like this, with an auto-increment with a counter:
variables: solution: '**/*.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' majorVersion: '1' minorVersion: '1' patchVersion: $[counter(format('{0}.{1}', variables['majorVersion'], variables['minorVersion']), 0)] productVersion: $[format('{0}.{1}.{2}', variables['majorVersion'], variables['minorVersion'], variables['patchVersion'])]
and *.nuspec like this:
<metadata><id>$id$</id><version>1.0.0</version> <!--just a placeholder because can't be empty--><authors>$author$</authors><description>some description</description><releaseNotes>some release notes</releaseNotes></metadata>
What do I want to achieve is to pass major and minor version variables from the *.nuspec to the *.yaml and also to keep auto-increment logic something like this:
<metadata><id>$id$</id><version>1.0.0</version> <!--just a placeholder because can't be empty--><customVar_MajorVersion>1</customVar_MajorVersion><customVar_MinorVersion>1</customVar_MinorVersion><authors>$author$</authors><description>some description</description><releaseNotes>some release notes</releaseNotes></metadata>
And use them something like this:
variables: solution: '**/*.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' majorVersion: $(fromMyNuspec.customVar_MajorVersion) minorVersion: $(fromMyNuspec.customVar_MinorVersion) patchVersion: $[counter(format('{0}.{1}', variables['majorVersion'], variables['minorVersion']), 0)] productVersion: $[format('{0}.{1}.{2}', variables['majorVersion'], variables['minorVersion'], variables['patchVersion'])]
Is it possible to get the behaviour as I described?
The closest question I found is this one, but there's no accepted answer.