BuildTaskVersionControl 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package BuildTaskVersionControl --version 1.0.3
                    
NuGet\Install-Package BuildTaskVersionControl -Version 1.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BuildTaskVersionControl" Version="1.0.3">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BuildTaskVersionControl" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="BuildTaskVersionControl">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BuildTaskVersionControl --version 1.0.3
                    
#r "nuget: BuildTaskVersionControl, 1.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BuildTaskVersionControl@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BuildTaskVersionControl&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=BuildTaskVersionControl&version=1.0.3
                    
Install as a Cake Tool

BuildTaskVersionControl

MSBuild Task to automate assembly versioning. Extracts a version string from one file and update it in other files.

Settings

  • InputFile: [Required] Path to file to extract version string. Use RegexInput to customize logic.
  • UpdateFiles: [Required] Path to files to inject with new version string. Use RegexOutput to customize logic.
  • AutoIncrease: If true, will increase version by one before updating files. If you use this, it's recommended to include InputFile in UpdateFiles. Does not work with '*' wildcard. Default: false
  • RegexInput: Regex string for the input file. Requires group 'version' for version string. Default: "(?<!Manager)(Version.*?)(?'version'[\d\.\*]{5,})"
  • RegexOutput: Regex string for output files. Is used in conjunction with RegexReplace. Default: "(?<!Manager)(Version.*?)(?'version'[\d\.\*]{5,})"
  • RegexReplace: Replacement string for output files. {version} is replaced by new version. Default: "${1}{version}"
  • TouchFiles: Update write-date when updating output files. Default: true
  • MaxMatch: Maximum number of lines to match and replace. 0 or less will replace all. Default: 0
  • Version: [Output] Extracted version string.
  • Major: [Output] Extracted major version.
  • Minor: [Output] Extracted minor version.
  • Build: [Output] Extracted build version.
  • Revision: [Output] Extracted revision version.

Example

  <Target Name="Versioning" BeforeTargets="PreBuildEvent">
    <Message Text="Start version control" Importance="High" />
    <ItemGroup>
      <a1 Include="output1.txt" />
      <a2 Include="output2.txt" />
    </ItemGroup>
    <VersioningTask InputFile="input.txt" UpdateFiles="@(a1);@(a2)">
      <Output TaskParameter="Version" ItemName="OutputVersionControl" />
    </VersioningTask>
    <Message Text="Finish version control @(OutputVersionControl)" Importance="High" />
  </Target>

Tips

With MSBuild 17 use ExcludeAssets="runtime" so the dll doesn't copy to output.

	<ItemGroup>
	  <PackageReference Include="BuildTaskVersionControl" Version="1.0.3" ExcludeAssets="runtime" />
	</ItemGroup>


When you want to auto-increase version while using MSBuild 17, disable GenerateAssemblyInfo and use AutoIncrease=true and TouchFiles=false.

	<PropertyGroup>
		<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
	</PropertyGroup>
	<Target Name="Versioning" BeforeTargets="PreBuildEvent">
		<ItemGroup>
			<a1 Include="Properties\AssemblyInfo.cs" />
			<a2 Include="output1.txt" />
			<a3 Include="output2.txt" />
		</ItemGroup>
		<VersioningTask InputFile="@(a1)" UpdateFiles="@(a1);@(a2);@(a3)" AutoIncrease="true" TouchFiles="false">
			<Output TaskParameter="Version" ItemName="OutputVersionControl" />
		</VersioningTask>
		<Message Text="Finish version control @(OutputVersionControl)" Importance="High" />
	</Target>


Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.0 131 7/6/2025
1.2.1 360 4/8/2023
1.2.0 295 4/1/2023
1.1.0 285 3/11/2023
1.0.4 473 9/28/2022
1.0.3 456 9/27/2022
1.0.1 461 9/15/2022