C# Language Automated versioning


Your code in source control has version numbers either by default (SVN ids or Git SHA1 hashes) or explicitly (Git tags). Rather than manually updating versions in AssemblyInfo.cs you can use a build time process to write the version from your source control system into your AssemblyInfo.cs files and thus onto your assemblies.

The GitVersionTask or SemVer.Git.Fody NuGet packages are examples of the above. To use GitVersionTask, for instance, after installing the package in your project remove the Assembly*Version attributes from your AssemblyInfo.cs files. This puts GitVersionTask in charge of versioning your assemblies.

Note that Semantic Versioning is increasingly the de facto standard so these methods recommend using source control tags that follow SemVer.