To assign the build number as the assembly version, PowerShell script available here can be used. Let’s see how to set this up for TFS builds step by step.
First, a small console application created below as the sample.
Code segment written to output the assembly version.
Setup a build in Visual Studio Team Services to build the application. Build number is set to represent version 4.1.3.X (the X is the build number for version 4.1.3). This can be set to match regex pattern "\d+\.\d+\.\d+\.\d+".
Set the repository path
This builds successfully and the build output contains the .exe.
Next download the “ApplyVersionToAssemblies.ps1” from here. Download link can be found in this page.
Add the script to the Team Project and check in.
Add new build step to execute PowerShell script.
Move the added step as the first step.
Set the script.
When build script downloaded from github this error occurs due to incorrect environment variable. The script is developed to work with TFS 2013 XAML template builds. The scriptceript should be updated to “$Env:BUILD_SOURCESDIRECTORY”, “$Env:BUILD_BUILDNUMBER”, instead of “$Env:TF_BUILD_SOURCESDIRECTORY”, “$Env:TF_BUILD_BUILDNUMBER”. Remove the “-not $Env:TF_BUILD” condition.
The above changes make the compatible to run with new TFS build. The assemblies now get updated with the build number as version number.
Subscribe to:
Post Comments (Atom)
Popular Posts
-
Dynamic block allows to create nested multi level block structures in terraform code. Conditional usage of such blocks are really useful in...
-
In Azure DevOps YAML pipelines there are several functions available for you to use. replace is such a useful function, which you can use t...
-
We have discueed, that we have to use an environment variable to handle input parameter default values, if we are using trigger for workflo...
-
Adding Azure Container Registry (ACR) service connection to Azure DevOps is really simple as described in " Create Service Connection ...
-
Some times a silly mistake can waste lot of time of a developer. The exception “System.IO.IOException: The response ended prematurely.” whil...
No comments:
Post a Comment