I have just released a new version of my VSTS Manifest Version Extension (1.5.22). This adds two new tasks to the set of versioning tasks in the extension. The complete set now is

  • VersionAssemblies - sets the version in the assemblyinfo.cs or .vb (used pre build)
  • VersionDotNetCoreAssemblies - sets the version in the *.csproj (used pre build)  - cross platform
  • VersionAPPX - sets the version in the Package.appxmanifest (used pre build)
  • VersionVSIX - sets the version in the source.extension.vsixmanifest (used pre build)
  • VersionDacpac - sets the version in a SQL DACPAC (used post build)
  • VersionNuspec - sets the version in a Nuget Nuspec file (used pre packing)
  • VersionSharePoint - sets the version in a SharePoint 2013/2016/O365 Add-In
  • VersionWix - sets the version in a Wix Project

As with all the other tasks, these new tasks aim to find files recursively to update with a version number extracted from the build number

Version .NET Core CSPROJ file

This is a cross platform task, written in Node.JS. It updates a version number in a .NET Core .CSPROJ file. There is a parameter so it can look for different XML node names

<Project Sdk="Microsoft.NET.Sdk.Web"> 

<PropertyGroup> 

<TargetFramework>netcoreapp1.1</TargetFramework> 

<Version>1.0.0.0</Version> 

</PropertyGroup> 

<ItemGroup> 

<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" /> 

<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" /> 

<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" /> 

<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" /> 

<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" /> 

</ItemGroup> 

</Project>

Version a Wix project

As Wix is a Windows technology, my new Wix task is only supported on Windows (PowerShell) build agents.

Due to the flexibility (complexity?) of Wix it does have to make some assumptions. I have documented them in the VSTS extension’s project wiki.

The summary is you need to put all the version number variable definitions in an installerversion.wxi file that is included into your Wix project. The task looks for and updates this file(s)

<?xml version="1.0" encoding="utf-8"?>  
<!-- Note that this file will be overridden by the build server. -->  
<Include>  
  <?define MajorVersion = "1" ?>  
  <?define MinorVersion = "0" ?>  
  <?define BuildNumber = "0" ?>  
  <?define Revision = "0" ?>  
  <?define FullVersion = "1.0.0.0" ?>  
  <!--WiX Installer Versions are Major.Minor.Revision -->  
</Include>

These variables can be used anywhere in the Wix project where needed e.g. to set the MSI version you could do the following

<?xml version="1.0" encoding="UTF-8"?>  
<?include InstallerVersion.wxi ?>   
<Wix xmlns="[http://schemas.microsoft.com/wix/2006/wi"](http://schemas.microsoft.com/wix/2006/wi")\>  
  <Product Id="\*" Name="WixProject" Language="1033" Version="$(var.FullVersion)"  Manufacturer="Test"  
           UpgradeCode="510ca227-7d91-43f4-881c-13319a07b299">

If you want a different number format just build it from the individual parts.

Hope you find them useful, as usual asked question on VSTS Manifest Version Extension Q&A or raise issues on Github