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.
It is great if the latest updates to TFS can be applied as and when they are released. But for a large organization it might not be sometime...
Resolve MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.0-rc4-004771\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found or Unable to start the process. No executable found matching command "dotnet-projectmodel-server"You might encounter compilation error in Visual Studio 2015 when a new .NET Core 1 web app is created, if you have installed Visual Studio 2...
TFS 2018 RC1 is now available and you can download it from https://www.visualstudio.com/downloads/ . Release note here explains the new fea...
You needed to setup dedicated machines for testing when using Run Functional Tests and you had to execute, Deploy Test Agent step and Copy...
This extension “ Chamindac.vsts.release.task.download-artifacts ” for VSTS and TFS 2015.2.1 upwards, can be used to filter for build artifac...