I am beginner to A and just starting to work in it
What task I must add in project ASP.NET CORE to Azure DevOps Pipelines to pass the build number from the azure devops pipeline to the project code Client.Shell.csproj:
<MinimumRequiredVersion> 4.60.0825.700 </MinimumRequiredVersion>
<ApplicationRevision> 716 </ApplicationRevision>
<ApplicationVersion> 4.60.0825.% 2a </ApplicationVersion>
I ended up using PowerShell task in my build pipeline to change the value of
<Version>
tag in the project file.Here is the fragment of my pipeline:
Note the first line with
name:
parameter. It makes the build number be a sequentially incremented integer number instead of something made up from current date, which would be the default. And that is what goes into$(Build.BuildNumber)
variable.The project file has the following fragment in it:
The regular expression will replace any number after the dot and before
</Version>
by the actual build number.I use
<Version>
tag, because I need to build a nuget. You can replace the<ApplicationRevision>
tag the same way if needed. And of course, "MyProject" is just a placeholder for your actual project name.If you need to do it in multiple projects, I would recommend keeping the version in a single
.props
file imported in every project and replacing in that file instead of replacing in multiple files.