Our DevOps Pipeline has versioningScheme set to off in the nuget pack command (options for that are documented here), and we're using the AssemblyVersion attribute in the AssemblyInfo.cs file to specify NuGet package versions. E.g.,:
[assembly: AssemblyVersion("1.9.14")]
We have a DevOps Pipeline setup that, when we merge code into our Git "develop" branch, will automatically perform a Debug build and publish to our private NuGet repository. The NuGet package version will match the AssemblyVersion attribute's value.
We have another DevOps pipeline that will do the same for the Master branch, but the build will be in Release mode.
We would like to have the Pipeline for the "develop" branch automatically append a string, e.g., "-beta" or "-dev", so that we can easily distinguish our pre-release builds, that are built in Debug mode, from the release builds. I've reviewed the YAML for our pipeline and I have been unable to figure out how to do that when you're using the AssemblyVersion (or AssemblyInformationalVersion) attribute. Is this possible? Or would we need to switch to a different technique for specifying versions?
YAML for our current Pipeline is below:
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
trigger:
- develop
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Debug'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: NuGetCommand@2
inputs:
command: 'pack'
packagesToPack: 'DataAccessLayer/DataAccessLayer.csproj'
versioningScheme: 'off'
- task: NuGetCommand@2
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: '2ba68ed5-dcd7-40e3-8b6b-06972c41ec5e'