How can I parse the specified version from the .yaml file to the .nuspec file?
Here are the important parts of the .yaml file
variables:
solution: '**/*.csproj'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
version.MajorMinor: '1.0'
version.Revision: $[counter(variables['version.MajorMinor'], 0)]
versionNumber: '$(version.MajorMinor).$(version.Revision)'
steps:
- task: DotNetCoreCLI@2
displayName: '$(buildConfiguration)'
inputs:
command: 'pack'
packagesToPack: '**/*.nuspec'
versioningScheme: 'byEnvVar'
versionEnvVar: 'versionNumber'
.nuspec file
<?xml version="1.0" ?>
<package>
<metadata>
<id>Project</id>
<version>0.0.1</version>
<description>Project description</description>
<authors>Me</authors>
</metadata>
<files>
<file src="bin\**\*.dll" target="lib" />
</files>
</package>
I'm using the .nuspec file so that I can include some other .dlls in the NuGet package. How can I parse the versionNumber variable to the .nuspec file using DotNetCoreCLI@2 task?
You can use
XmlTransformV1@0task to overrideversionNumberin your Pipeline:https://marketplace.visualstudio.com/items?itemName=dzhukovsky.xml-transform
Build defenition:
Release definition: