REGARDING VISUAL STUDIO 2022:
This has been sitting as a download link on the Version 2 download page for a while in preview mode. A generous donation that caught my attention with a request to publish in the Marketplace came through so thank you and here you go!
We appreciate that some have said they would contribute if we open-sourced it, but that is easier said than done. For that to work on an older project like this it would require a lot up front work and then for an open-source project to succeed it also would require a lot of support from us that would quite frankly take more time than us doing the actual work. If you really would like to help, you can donate or leave a 5-star review to show your support, thanks!
Version 2 is still in the marketplace and supports older versions of VS: (https://marketplace.visualstudio.com/items?itemName=PrecisionInfinity.AutomaticVersions)
Automatic Versions is created and maintained by Precision Infinity.
(suggested amount: $40 per install instance/year)
Paid support available upon request.
Please use the Q&A tab for all bug reports. If you do have an issue, we'd love the chance to resolve it before you post a review. We want the tool to be an awesome improvement to your daily productivity and to always work as you expect.
The Automatic Versions plugin is designed to improve productivity by automatically incrementing Assembly, AssemblyFile, AssemblyInfo, ClickOnce, and package version(s) for C# and VB projects for Full .Net, .Net Standard and .Net Core.
Settings are configurable as granular as at the Configuration (Debug/Release) level of a Project, or more generically at the Solution level, or a global user default for all solutions. Additionally, regular .Net projects can also have settings at the project level to apply to all configurations.
For each level that settings can be applied the following options are available:
- Inherit/Not Set - Each Version type has the option to inherit settings from a parent level, or in the case of the global defaults, Not Set, is used to tell Automatic Versions not to do anything with that version type
- Custom System.Version - Allows incrementation options for the Major.Minor.Build.Revision version format
- Custom Semantic Version (BETA/PRO) - Allows options for Major.Minor.Patch-prerelease version format (This setting is only available for AssemblyInfo (Full .Net) and Package (.Net Standard/Core).
- Assembly Version - If set, updates the AssemblyVersion attribute in the AssemblyInfo.cs./vb file. This value is used by .Net to determine which version of a library to load if strong naming is used. This version number can be referenced using the following code snippet:
var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
Console.WriteLine(version); // -> "22.214.171.124"
- Assembly File Version - If set, updates the AssemblyFileVersion attribute in the AssemblyInfo.cs/.vb file. This value is used by the operating system as the "File Version" in the details tab of the dll or exe. An example of how the file version can be used is to increment it if you apply a patch to your product where the functional underlying APIs are the same for backwards compatibility. You would leave the AssemblyVersion the same, but increment the FileVersion to know which dlls/exes had the patch and which did not. File version can be accessed from code with the following:
var assemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location;
var fileVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(assemblyLocation).FileVersion;
Console.WriteLine(fileVersion); // -> "126.96.36.199"
- Assembly Info Version - (.Net Framework) If set, updates the AssemblyInformationalVersion attribute in the AssemblyInfo.cs/.vb file. This value is used by the operating system as the "Product version" in the details tab of the dll or exe. This version type is special because it has the option to be used for Semantic Versioning, which can be used for NuGet Publishes. Alternatively, this version attribute can have 'prefix text' that can contain your product name. To use Prefix text, set the static Prefix text in the AssemblyInfo file and Automatic Versions will ignore it and only update the version numbers. Don't use prefix text with Semantic Versioning because the Semantic Versioning specification doesn't allow it. Assembly Informational Version can be accessed with the following code:
var assemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location;
var version = System.Diagnostics.FileVersionInfo.GetVersionInfo(assemblyLocation).ProductVersion;
Console.WriteLine(version); // -> "1.2.32-alpha-01"
Package Version (BETA/PRO) - (.Net Standard/Core) If set, updates the Package Version attribute and will automatically be used in the nuget package manifest. The only option for this is Semantic Version. The way to get this version in your project is the same as Assembly Info Version.
ClickOnce Version (BETA/PRO) - If set, updates the ClickOnce Version to match the AssemblyVersion or AssemblyFileVersion.
Custom System.Version Options
Major, Minor, Build, and Revision can be individually configured to the incrementation type desired:
In these examples, we use the date July 29th 2024, 1:30pm
- None - Do not increment this value.
- None w/AutoReset - Lets you set the value manually and will not be changed, unless a more significant number increases, in which case it will reset to 0.
- Increment (Always) - Always Increments this value by 1*
- Increment w/AutoReset - Increments this value by 1, unless a more significant number increases, in which case it will reset to 0.
- On Demand (Build New Version) - Increment this value by 1 only when a build is initiated using the Build New Version command (on the context menu of each project). You can set this value on both the Major and the Minor numbers and use the context menu (see usage below) to control which one is incremented.
- On Demand w/Reset (Obsolete) - Use Increment w/AutoReset instead. This feature may not be supported in future versions of the product. (Legacy functionality: Increment this value by 1 only when a build is initiated using the Build New Version command (on the context menu of each project). Resets all Increment sub-values.)
- Day Of Year (ddd) - Set this value to DateTime.UtcNow.DayOfYear: 211.
- Day (dd) - Set this value to the current day of the month: 29.
- Month (MM) - Set this value to the current month of the year: 7.
- Year (yyyy) - Set this value to the current year: 2024.
- Short Year (yy) - Set this value to 2 digit current year: 24.
- Date (yyddd) - Set this value to the current date (yyddd format - where ddd is the day of year)**: 24211.
- Date (MMdd) - Set this value to the current date (MMdd) where MM is a 2-digit month and dd is a 2-digit day of month: 0729.
- UTC Time (HHmm) - Set this value to the current time (HHmm format): 1330.
- Delta Days (since 1/1/2000) - Set this value to the number of days that have occurred since January 1, 2000: 8976.
- UTC Seconds Since Midnight/2 - If you are using a custom unique time based stamp for your version number, this gives you the most granularity to a single day. The number has to be divided by 2 so it doesn't overflow the max value.
*There is an exception to this rule when Increment On Demand w/Reset (Obsolete) is used it will reset this value if you choose Build New Version
**This value will overflow in 2065. Since it is very useful and there are limited alternatives that work as well as this one, we are continuing to use it and even recommend using it, however, we may change it's functionality at some point such that it does not overflow in 2065. The overflow itself is not a security issue, however. It will only cause a build error.
Custom Semantic Version (BETA/PRO)
Semantic Versioning is typically used for 'packaging' the results of a build for use in a manifest file or as a 'published package' of your product. Therefore Semantic Versioning leverages the other version attributes by letting you choose which of those you want to use for your Major/Minor numbers, and independently does it's own incrementation on the Patch and Pre-Release numbers.
- Major/Minor settings - Set to use AssemblyVersion, AssemblyFileVersion, or Set Manually. To set manually, open the AssemblyInfo file (for Full .Net) or the project properties (for .Net Standard/Core) and manually set the major and minor values.
- Patch settings - This will increment the Patch number based on the incrementation settings. Increment Once is available for when you switch to a 'pre-release' version of the product, you will typically want the Patch number to Increment Once for the start of your pre-release cycle. After incrementing once, this setting will automatically update to None (whereby Pre-Release will be doing the incrementation).
- Pre-Release (optional) - Set to alpha, beta, preview, rc, or N/A (release). If you set a pre-release, then Patch will automatically change to "increment once" for you and the prerelease will increment instead starting with alpha, then alpha-01, alpha-02, etc. When you set this to (N/A release) then Patch will be automatically changed to Increment w/AutoReset for you.
- Event Logging - Let's you enable/disable logging of Automatic Version events. (e.g. "Upgraded from version x -> y")
- AssemblyInfo Location (optional) - Specifies a custom location of the AssemblyInfo class file. The default location is in the Properties folder.
- Primary Version Type - Setting this option to a value other than None will store the selected attribute's value as a MSBuild property named "AssemblyVersions". This allows developers to use a custom build process without needing to parse the version number from a text file or the AssemblyInfo source file.
To configure Automatic Versions, go to the Tools Menu -> Automatic Versions Settings
Each time you build your project, the versioning will automatically change.
To use the "On Demand" version options, right click on the project and choose "Build New Version" to increment all "On Demand" settings, or use "Build New Major Version" or "Build New Minor Version" to just increment the settings that have "On Demand" set for Major or Minor respectively.
- Bugfix: Now reliably adds any missing version attribute if its not already there. Previously it would only add them all if none of them were there.
- Bugfix: Now consistently updates the .csproj or .vbproj file's primaryversion number variable if a primaryversion is set in the settings. Previously it was only setting this value if there was a previously existing attribute in the assembly info file.
- Bugfix: Now outputs a proper tag for vb files when the asssemblyversion attribute is not already there
- Bugfix: More consistently generates the assemblyversion tag for c# files if its not already there