Skip to main content

Azure DevOps - Create a prerelease nuget package using versionsuffix

Creating a prerelease package is not that hard. The dotnet core task allows you to invoke the pack command and gives you the option to use Automatic package versioning:

This will give you 3 options to expand your package version:

  • 'Use the date and time':  this will generate a SemVer -compliant version formatted as X.Y.Z-ci-datetime where you choose X, Y, and Z.
  • 'Use an environment variable'; this allows you to select an environment variable
  • 'Use the build number', this will use the build number to version your package.

If neither of these options is OK for you, know that there exists another alternative:

  • By adding a VersionSuffix build property you can specify any prerelease value you want.