If you are generating NuGet packages which have dependencies on pre-release NuGet packages, you need to mark your package as pre-release by adding a suffix to the version number such as '-beta1'.
In the NuGet Packager settings in VSTS you can turn off automatic package versioning and add a NuGet argument of "-version 1.0.0-beta1". This will work for the first build, but on subsequent builds the package will fail to publish because a package with the same version number already exists.
If your build number is in a suitable format you can just add "-beta1" to the end of it and then in the NuGet Packager build step set automatic package versioning to 'Use an environment variable' and the environment variable to 'BUILD_BUILDNUMBER'.
If you do not want the build number to be the same as the package version (you may not want the build to be tagged as beta), you can use a variation on the steps here.
- Add a PowerShell Script step before the NuGet Packer step
- Set the Type to Inline Script
- Set the Inline Script to something like:
$PackageVersion = "$env:BUILD_BUILDNUMBER-beta1"
Write-Host ("##vso[task.setvariable variable=PackageVersion;]$PackageVersion") - As before, set the NuGet Packager to use an environment variable (in this case PackageVersion)
Regardless of your approach, you will probably also need a delete step as described here to delete old packages from the build server before creating new ones.
- Add a Delete Files step to the start of your build definition
- Set the Source Folder to $(Build.Repository.LocalPath)
- Set the Contents to *.nupkg