I have no experience with Jenkins, but this is what I do in my post build script. The version is passed via the @(VersionNumber)
parameter to a powershell script which the modifies the .nuspec
file. I would assume you may have to do something similar before you call the Execute Windows Batch Command
function to releasify your app.
Visual Studio Post-build event command line
if $(ConfigurationName) ==Release "C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy RemoteSigned -file "$(ProjectDir)\"PostBuild.ps1 "$(ProjectDir) " @(VersionNumber)
PostBuild.ps1
param (
[string]$ProjectDir,
[string]$Revision
)
#write new version to nuspec
$nuspec_file_name = "Package.nuspec"
$nuspec_file_path = "$ProjectDir$nuspec_file_name"
Write-Host "nuspec file: $nuspec_file_path"
[xml]$nuspec_xml = Get-Content($nuspec_file_path)
$nuspec_xml.package.metadata.version = $Revision
$nuspec_xml.Save($nuspec_file_path)