Skip to content

Package Versioning

Ryan Christiansen edited this page May 22, 2017 · 8 revisions

The package identifier <id> and the version number <version> are the two most important values in the manifest because they uniquely distinguish your module from others in the package repository like nuget.org.

The version of the package should follow the Major.Minor.Patch Semantic Versioning pattern and must be unique for every release you distribute.

Versioning from the Kentico Admin

By default, the module metadata and version for an installation package are managed from the Modules application of the Kentico admin.

Kentico Module Administration

The following command will produce a NuGet (.nupkg) package identical to one produced by clicking the Create installation package button.

PackageBuilder.exe -module:Acme.Module

In this example, the package Acme.Module_1.0.0.nupkg will be written to the website CMSSiteUtils\Export directory.

Manual Versioning

For continuous integration environments, it is often necessary to set the package version at build time. The following example explicitly overrides the module version stored in the database with 1.0.0-CI20170510.

PackageBuilder.exe -module:Acme.Module -version:1.0.0-CI20170510

As with any command-line interface, this value could also be set from an environment variable.

PackageBuilder.exe -module:Acme.Module -version:1.0.0-CI%build.number%

In either case, the version specified in the Kentico admin will be replaced by the command-line declaration. In the above example, a %build.number% of 20170510 would produce the package file Acme.Module_1.0.0-CI20170510.nupkg.

Extracting Version Information from an Assembly File

It is also possible to extract a package version from the attributes of a compiled assembly. For example, when version information is updated in the AssemblyInfo.cs file manually or injected dynamically during an automated build, the same version can be used by Package Builder to generate the final NuGet (.nupkg) package.

PackageBuilder.exe -module:Acme.Module -version:assembly=Acme.Module.dll,assemblyAttribute=AssemblyInformationalVersion

Important: Assembly file paths are relative to the website root or bin directories. Absolute file paths to other locations are also permitted provided that appropriate read permissions are assigned.

It is not necessary to specify an assembly name unless it differs from the module code name. The following command is functionally identical to the previous example.

PackageBuilder.exe -module:Acme.Module -version:assembly,assemblyAttribute=AssemblyInformationalVersion

The following assembly attributes are currently supported:

Attribute Type Description
AssemblyVersion The assembly identity version
AssemblyFileVersion (default) The assembly file version
AssemblyInformationalVersion (recommended) The assembly version information