0
votes

Is there any way to automatic add the build number to the web.config before build?

There are times i forget to update the build number in the web.config before commit, so i wasn't try to figure out a way to automatic add the build number to web.config.

I know TFS 2015 in build configuration, we can run script before or after build.

I am trying to figure out, what's my options.

Thanks

2

2 Answers

0
votes

That's right! I suggest you take a look at the following article on MSBuild Configuration :)

Simple MSBuild Configuration: Updating Assemblies With A Version Number

0
votes

Place a run powershell task before MSBuild and use powershell script to update the web.config file.

A examlple to this is given on the below blog

https://blogs.msdn.microsoft.com/sonam_rastogi_blogs/2014/08/18/update-configuration-files-using-powershell/

use the $(BUILD_BUILDNUMBER) to update the value in the we.config file