Currently my build produces both packages having a newer version every time:
Release: Automatic package versioning = Use the build number
Pre-release: Additional build properties = Version=$(user.BuildFullVersion)-beta
And the only one nuspec has a placeholder to version:
<version>$version$</version>
I want to increment version manually, that it - repetitive build would produce same version until I increment it manually.
How can I achieve that still having single nuspec?
Can I adjust package version in the pack tasks like this:
Release: $(PackageVersion) = $(PackageVersion)
Pre-release: $(PackageVersion) = $(PackageVersion)-beta
Or something similar.
To produce two packages by a nuspec, you can use two NuGet tasks (NuGet custom instead NuGet pack):
NuGet task:
Command: custom
Command and arguments:
NuGet task:
Command: custom
Command and arguments:
If you set the
$(Build.BuildNumber)
as the format likeMyProject-Daily_1.0.94.0
while you want to add the version for nuget package as1.0.94.0
, you can define a variable in your build definition and set the value by cutting the substring of$(Build.BuildNumber)
. detail steps as below:In Variables Tab, add a variable (such as
version
) with any value (such astemp
).Add a PowerShell Task before NuGet tasks with the settings,
Type: Inline Script
Inline Script:
Then in the NuGet Custom tasks use
$(version)
to replace$(Build.BuildNumber)
for-version
option. Such asnuget pack -version $(version)
.