I have an azure pipeline set up to build a .net framework class library. The current setup is 1 Solution and 1 Project within the solution and this all works fine. I use the Assembly Info Reader
extension to read AssemblyInfo.cs
which is used for versioning. This works fine and completely as expected.
What I'm wanting to achieve is to add a second project to the solution and build this using the same pipeline and it's own versioning from the AssemblyInfo.cs
file in the second project. This somewhat works in the sense that it build the project fine however it seems that I can't use separate AssemblyInfo.cs
files to give each file it's own version. eg
I'm expecting Project1.0.1.0-ci-20230117-153658
& Project2.2.0.0-ci-20230117-153658
But I'm getting Project1.2.0.0-ci-20230117-153658
& Project2.2.0.0-ci-20230117-153658
So they're both taking the same version number rather than separate ones.
The Steps in my pipeline are below.
steps:
- task: NuGetCommand@2
displayName: 'NuGet restore'
- task: MSBuild@1
displayName: 'Build solution **/*.sln'
- task: kherzog.AssemblyInfoReader.assembly-info-reader-build-task.AssembyInfoReader@3
displayName: 'Generate variables **\AssemblyInfo.cs '
- task: NuGetCommand@2
displayName: 'NuGet pack'
inputs:
command: pack
versioningScheme: byPrereleaseNumber
majorVersion: '$(AssemblyInfo.AssemblyVersion.Major)'
minorVersion: '$(AssemblyInfo.AssemblyVersion.Minor)'
patchVersion: '$(AssemblyInfo.AssemblyVersion.Build)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'