Skip to content

Example configuration file

Imre Pühvel edited this page Jan 3, 2021 · 1 revision

The tool picks up configuration from the following files

  • project .csproj file
  • Properties/Nortal.Utilities.AssemblyVersioning.MsBuildTask.props
  • Nortal.Utilities.AssemblyVersioning.MsBuildTask.props

Example configuration file:

<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
	<PropertyGroup>
		<!-- override how to generate each version number: -->
		<GeneratorForInformationalVersion>NugetSemanticVersion</GeneratorForInformationalVersion>
		<GeneratorForFileVersion>HumanReadable2SlotTimestamp</GeneratorForFileVersion>
		<GeneratorForConfiguration>HumanReadableBuildInfo</GeneratorForConfiguration>

		<!--
The following prepared generators are available:
			HumanReadable2SlotTimestamp      Example: "1.2.50329.1359"                  ( meaning: built on UTC 2015-03-29 13:59)
			HumanReadable1SlotTimestamp      Example: "1.2.3.50329"                     ( meaning: built on UTC 2015-03-29)
			HumanReadableBuildInfo           Example: "Debug (on UTC2015-03-29T13:59:56 by UserName at BuildServer)
			NugetSemanticVersion             Example: "1.2.3" for production or "1.2.3-Debug-20150329-1359" for prerelease
			Skip                             Attribute will not be generated
or create a custom version string, for example:
			{Major}.{Now:yyyy}.{Now:MM}.{Now:dd}
			Built on {Domain}\{MachineName}, mode {BuildConfiguration}
Tokens available for use:
			{Major} {Minor} {Build} {Revision}
			{Domain} {UserName} {MachineName} {BuildConfiguration}
			{Now} {NowDateNumber} {NowTimeNumber} {UtcNow} {UtcNowDateNumber} {UtcNowTimeNumber}
			{CustomField1} .. {CustomField3}
Check https://github.com/nortal/AssemblyVersioning/wiki/Generator-options for more documentation.
		-->

		<!-- Add some MSBuild magic here to fill those custom markers above: -->
		<AssemblyVersioningCustomField1> Some.. </AssemblyVersioningCustomField1>
		<AssemblyVersioningCustomField2> .. magic .. </AssemblyVersioningCustomField2>
		<AssemblyVersioningCustomField3> .. here! </AssemblyVersioningCustomField3>

		<!-- override the location of base version (if defining via AssemblyVersionAttribute) -->
		<AssemblyVersioningBaseVersionFile>Path/To/My/AssemblyInfo.cs</AssemblyVersioningBaseVersionFile>
		
		<!-- override the output file location for the generated version attributes: -->
		<AssemblyVersioningOutputFile>Path/To/My/AssemblyInformationalVersion.gen.cs</AssemblyVersioningOutputFile>

		<!-- override what you consider prerelease version -->
		<AssemblyVersioningIsPrerelease Condition=" '$(Configuration)' == 'Debug'">True</AssemblyVersioningIsPrerelease>
	</PropertyGroup>
</Project>
Clone this wiki locally