Yamamari.AutoVersion 12.0.13

dotnet add package Yamamari.AutoVersion --version 12.0.13
                    
NuGet\Install-Package Yamamari.AutoVersion -Version 12.0.13
                    
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="Yamamari.AutoVersion" Version="12.0.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Yamamari.AutoVersion" Version="12.0.13" />
                    
Directory.Packages.props
<PackageReference Include="Yamamari.AutoVersion" />
                    
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 Yamamari.AutoVersion --version 12.0.13
                    
#r "nuget: Yamamari.AutoVersion, 12.0.13"
                    
#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 Yamamari.AutoVersion@12.0.13
                    
#: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=Yamamari.AutoVersion&version=12.0.13
                    
Install as a Cake Addin
#tool nuget:?package=Yamamari.AutoVersion&version=12.0.13
                    
Install as a Cake Tool

Auto-Version by Yamamari

This is intended to be a lightweight utility for synchronizing and incrementing the various version counters across a C# solution.

Configuration Step 1

Add the package to any one project in your solution. It does not matter which project you add it to as long as the project you select will be built whenever you want the versions updated. The process will update the versions of all projects in the solution.

<ItemGroup>
    <PackageReference 
            Include="Yamamari.AutoVersion"
            Version="5.1.4"/>
</ItemGroup>

Configuration Step 2

After adding the package to your project, you must configure it to execute a post-build process. This must be post-build so the dlls exist and can be inspected. This requires opening the .csproj file and directly modifying the xml.

Once it's opened, find the ItemGroup that includes the package import for Yamamari.AutoVersion.

You must add the attribute GeneratePathProperty to the AutoVersion package reference and set it to true.

<ItemGroup>
    <PackageReference 
            Include="Yamamari.AutoVersion" 
            GeneratePathProperty="true" 
            Version="5.1.4" />
</ItemGroup>

Configure Step 3

Now that we have the package ready to be used, we need tell our build process how to use it. This is also done by directly modifying the xml of our project's .csproj file.

We need to add an XML block to add our build step. The example below should work perfectly.

<Project Sdk="Microsoft.NET.Sdk">
    <UsingTask TaskName="AutoVersion" AssemblyFile="$(OutDir)AutoVersion.dll" />
    <Target Name="RunCustomTask" AfterTargets="PostBuildEvent">
        <AutoVersion />
    </Target>
</Project>
About The Settings
  • <UsingTask TaskName="AutoVersion" tells us what class we're going to be loading from our assembly
  • $(PkgYamamari_AutoVersion) is the macro that was automatically generated when we added the GeneratePathProperty attribute to our package import. This property tells us where on disk the specified NuGet package is stored. We needed to know that in order to tell the build system where to find the code for our custom task.
  • <Target Name="IncrementTheVersion" merely names our step
  • <Target AfterTargets="PostBuildEvent" tells MSBuild when to run this task. Ultimately this isn't important aside from determining whether the value will be incremented before or after we build. As long as we're consistent, it doesn't matter which we choose.
  • <AutoVersion /> this invokes our custom build task

Configuration Step 4

The utility will only override version settings that have already been provided to the .csproj file, it will not add them. So, be sure to add seed values to any versions you want to have synchronized and automatically incremented.

You do not need to add all of these for the process to work.

If any of these versions don't match, the utility will take the highest of these versions from across all projects and start keeping the values in sync going forward.

<PropertyGroup>
    <AssemblyVersion>1.0.13</AssemblyVersion>
    <PackageVersion>1.0.13</PackageVersion>
    <FileVersion>1.0.13</FileVersion>
</PropertyGroup>

Configure Step 5

To avoid merge conflicts for developers and to still use the utility for published versions, you can add a condition to the csproj file's build step to only run the utility when the configuration is set to "Release" or your equivalent.

<Project Sdk="Microsoft.NET.Sdk">
    <UsingTask TaskName="AutoVersion" AssemblyFile="$(OutDir)AutoVersion.dll" />
    <Target Name="IncrementTheVersion" Condition="'$(Configuration)' == 'Release'" AfterTargets="PostBuildEvent">
        <AutoVersion />
    </Target>
</Project>
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Yamamari.AutoVersion:

Package Downloads
Yamamari.ShellSharp

A framework for easily creating C# classes that can be invoked via the command line.

Yamamari.PluginArchitecture

Package Description

Yamamari.StringConverter

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
12.0.13 204 11/25/2025
11.0.1 228 3/31/2025
9.0.1 536 3/26/2025
8.0.25 530 3/26/2025
8.0.14 516 3/25/2025
8.0.10 528 3/25/2025
8.0.7 524 3/25/2025
1.0.9 925 11/20/2022
1.0.8 3,599 9/5/2022
1.0.3 544 9/5/2022
1.0.2 530 9/5/2022
1.0.0 534 9/5/2022