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...
You needed to setup dedicated machines for testing when using Run Functional Tests and you had to execute, Deploy Test Agent step and Copy...
TFS 2018 RC1 is now available and you can download it from https://www.visualstudio.com/downloads/ . Release note here explains the new fea...
If you have upgraded the TFS from TFS 2015 to TFS 2018 you will encounter a situation where your vNext build agents 1.xx are no longer valid...