Build variants

One program, several setups. A product sold in Germany, France and Russia needs an installer for each country — only in its language, with its own services and server addresses — and all of them have to be tried on one computer. Build variants make them from one project, so a change is made once and goes into every setup.

5 min read
In the app: ? next to the title of Build variants opens this page.

When you need it

Without variants you would keep three copies of the project, and a file added to one would be forgotten in the others. With variants there is one project: what all of them share is set once, and each variant has only what is its own.

The section is not on the left until you add it: Add a feature under Product. It stands before the files and the registry because the variants decide what goes where. A project without variants is one product, as before.

How they install

Side by sideEach replaces another
What they areSeparate productsOne product in several kinds
Product codeEach variant has its ownShared: the one in Version upgrades
On one computerAll of them at once: three entries in the list of programs, three foldersOne at a time: installing FR over DE removes DE
ForMarkets and editions; trying every variant on your own computerA customer who moves from one market or edition to another

What each variant has

FieldWhat it is
TagA short name — DE, Pro, up to 16 Latin letters, digits, - and _. It is {Variant} in any field.
NameWhat it is for people: Germany, the free edition.
LanguagesThe installer's languages in this variant, from the project's. One language: the installer speaks only it and asks nothing. None ticked: all of the project's.
Product codeSide by side only: its own code, so Windows sees a product of its own. Keep it from version to version.
File nameThe setup file: {ProductName}-{Version}-{Variant} makes LedgerPro-5.2.0-DE.exe.
In the list of programsIts name in Settings and Programs and Features: {ProductName} ({Variant}).
FolderThe name of its folder under Program Files\Publisher (or the user's Programs): {ProductName} {Variant}.
Own valuesThe values of Properties and variables as this variant gives them: a server's address, a gateway, a support line. An empty one is the project's.

A new variant starts as a copy of the whole project: all files, all languages, a new code. Copy of the variant does the same from another variant, with the files and keys marked for it.

If the project has a Software tag, each variant side by side gets a tag id of its own, made from the project's and shown on its card, so asset tools count the variants as the products they are.

What goes in a variant

Files, shortcuts, registry keys and prerequisites have the variants they go in at the end of their line: in all, or the tags of the ones that have them. Click it to tick the variants:

A folder rule in Files and folders takes everything it finds with it, so the banking services of the German variant are one folder marked DE.

Show the project as one variant

When the project has variants, Show appears at the top of the editor. Choose a variant, and Files and folders, Shortcuts, Registry and Prerequisites show the project as that variant has it: what isn't in it is paler. In every field {Variant} reads its tag, and own values read as that variant gives them. All variants shows everything.

Checks between variants

Each variant is checked as a product of its own, and then all of them against each other: what two of them share where Windows allows only one. The section lists those under Shared where they can't be, each with a fix as a button; the editor offers the fix and doesn't make it unasked.

What is comparedWhy one for two is a problemThe fix offered
The setup file's nameOne build writes over the other-{Variant} in the file name
The install folderOne overwrites the other's files; removing one breaks the other{ProductName} {Variant}
The name in the list of programsThree alike entries, hard to tell apart{ProductName} ({Variant})
The product codeWindows takes them for one product: the second replaces the firstNew codes
A registry keyTheir settings mix\{Variant} at the end of the key
A shortcutOnly the last one installed stays ({Variant}) in its name

When variants replace each other, only the file name is compared: the rest is meant to be shared.

A registry key with {Variant} in its path is a key per variant — your program then has to read its own key. Give it the tag in a shortcut's arguments or in its settings file: --market {Variant}.

Building

Build makes every variant, one after another, into the build folder: LedgerPro-5.2.0-DE.exe, LedgerPro-5.2.0-FR.exe, LedgerPro-5.2.0-RU.exe. Each is built from the project as that variant: its languages, its code, its values, and only the files, shortcuts, keys and prerequisites marked for it.

Try them on your computer

With variants side by side, install all of them: Programs and Features lists each by its own name, each has its own folder, and each one's uninstall removes only itself. PowerShell shows them:

Get-ItemProperty HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*,
                 HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* |
  Where-Object DisplayName -like "Ledger Pro (*" |
  Select-Object DisplayName, DisplayVersion, InstallLocation

In MSI

When Cobalt Installer builds MSI files, the variants map to its codes like this:

How they installUpgradeCodeProductCode
Side by sideEach variant's own — its product code hereNew for each version of each variant, made for you
Each replaces anotherShared — the project's product codeNew for each variant and version, made for you