Installer with Online Registration for Windows Application

One-Shot Setups: “A setup is run once, an application can be started again - in order to resolve and debug problems interactively - with meaningful error messages show to the user.

Hence: avoid license validation in the setup.


Short version on licensing.


License Key: Preferring to deal with license keys in your application seems logical for several reasons: the one-shot nature of setups
yields poor reliability (no interactive debugging – poor ability
to resolve problems). The end result is lots of support calls for something very trivial.

Further, the risk of piracy and hacking is a major concern when
exposing a license validation DLL in the setup. And finally
communication over the Internet is difficult with today’s setups (proxies, firewalls, etc...) – which is a modern way to validate license
keys (in the future setups might have full Internet access, but be careful assuming too much since corporate users may have lots of restrictions and poor deployment could hurt sales and acceptance of the software for corporate use).

Finally your application must usually support a trial version,
and then you need a license dialog in your application anyway.
Why complicate your setup too?

CAs: Custom actions are complex and vulnerable to failure in general – due to complex sequencing-, conditioning- and
impersonation issues and overall poor debugability. More information:
Why is it a good idea to limit the use of custom actions in my WiX / MSI setups?


Overall Complexity of Deployment: A short, attempted summary of the overall complexity of deployment:
Windows Installer and the creation of WiX
(section "The Complexity of Deployment").


I would remove all licensing features from the setup and add them to the application. Your setup can still write a license to disk or to the registry by passing it to msiexec.exe as a public property
UPPERCASE properties (or you can “hide” things a little more by using a transform to apply the serial property – it has exactly the same effect as setting the property on the command line). You can also set the LICENSE property from a dialog in the setup when it is run interactively, but my favorite approach is to allow adding the license key unvalidated to the registry in silent deployment mode, and to instead enter the license key directly in the application, and not the setup, for interactive deployments (the above description is for silent deployment):

msiexec.exe /I "C:\Install.msi" /QN /L*V "C:\msilog.log" LICENSE="123-456-789"
  • This will allow the license to be easily added to each machine in a corporate deployment scenario. The license value is simply written to disk or registry without validation. The application will verify it (more secure than a validation dll in the setup).
  • There is no need to mess with any complex setup dialogs, but you will need a license dialog in your application as explained below.
  • As a setup developer you should offer to help implement the feature in the application instead of the setup so it doesn’t seem like a case of “passing the buck“. This is all for overall software reliability and foolproofness – and several reasons are listed below.
  • Almost all large corporations deploy MSI files silently, so the setup GUI will be ignored most of the time anyway. You are then simply adding risk and wasting resources if you deal with licenses in the setup.
  • One drawback: An application run as a non-admin user after installation can not write to HKLM to share a serial between all users on the computer (a setup running with elevated rights can). It must either write to HKCU or the setup must have prepared write access to a specific HKLM location in the registry for the application to write to. I prefer writing to HKCU for each user since the license is then less available for copying by others, and it is kept as user specific data (allows roaming, though that is a hated feature by most IT professionals). However, a HKLM license key written by the application or the setup during installation (as explained above with a public property set) allows all users to share a license when launching the application.

There are several more concrete reasons to keep license handling and validation out of your setup:

  • A significant number of support requests always result from people who have problems registering their license keys in the setup. A setup is run once, an application can be started again if there are problems. This is more important than you might think for inexperienced users. You also have better features available to handle exceptions and error conditions and whatever unexpected problems may occur in the application.
  • Serial validation in the setup exposes a validation dll / method that is easily cracked by pirates. You won’t prevent piracy by eliminating it from your setup, but at least you make it more difficult. It is more secure in the application if you cloak things a bit (static linking, encryption, obfuscation, putting the validation process online, and / or whatever is done by security professionals that I am unfamiliar with).
  • Allow application trial version: If the setup needs to support a trial version of the application, you should allow the user to enter a license key if they end up buying the product – preferably without having to re-run the setup or uninstall / reinstall just to add the license key. In other words you will likely need to deal with licensing in your application anyway, why complicate your setup too? More risk, more QA, more potential support requests and potential for multiple required fixes in both setup and application. High total cost?
  • If your application runs with different editions, what if the user buys an upgraded license? They should just be able to enter it into the license dialog and unlock features if possible and not uninstall and reinstall with all the clunk that involves. For some upgrades this is hard to achieve though, and you often end up with separate setups for different editions.
  • If the network is using a proxy server for Internet access, you will have problems registering the license over the Internet during the setup (often asked for by marketing). You have more features to check and deal with this in the application – it can try again and wait for access (generally you hook up to IE for automagic proxy configuration if possible). For corporate deployment you need a silent install option too which doesn’t validate the key but just writes it to the registry. Trying to access the Internet from a silent install of an MSI is in my opinion a rather extreme deployment anti-pattern. I find it dubious in the setup GUI as well. Do the registration in the application – much less controversial, and you can set up firewall rules to allow it to access the Internet (msiexec.exe is likely blocked – and for good reason). There could also be hardware firewalls and / or security software to deal with that makes Internet access difficult or even impossible without some clunky admin server configuration. This could kill your software from consideration is my experience: “Just get this off our network and application estate – there must be better options – far too clunky and error prone“.
    • UPDATE: As deployment technology matures and becomes more “Internet based” this “truth” may change, and we could end up doing everything “online” with deployment designed specifically to run via online “repositories” for example. We will have to wait and see. For now my opinion is that any setup Internet access requirements are erroneous and undesirable.
  • Setups that mess with licensing may sometimes cause license data to be deleted during upgrades, patching and migration scenarios due to bugs in the setup. This is a lot more serious at times than you would think – the package might hit thousands of workstations in large companies and be cumbersome to fix.
    • There is a rather bad “anti-pattern” in the MSI technology itself whereby self-repair or manually triggered repair will reset values in the registry that has been changed by the application. This can wipe out license keys. We see this all the time, and it is the technology’s fault. It is just not logical in this area.
    • There are some fixes – or rather workarounds – for this (use a permanent component, write license from a custom action instead of from a component, etc…), but I find them quite clunky and you have to have a lot of experience to know all the pitfalls – and even experienced users mess this up.
  • Licensing is a huge corporate headache – often what is desired by a company or corporation is that licensing is centrally managed on a server, and not based on text serial numbers at all (for example concurrent or floating licenses acquired on application launch via the network). Just mentioning this though it is sort of out of scope for the question. In these cases what you specify during installation is generally an IP address pointing to the license server, or just a regular host name to be resolved by WINS or DNS.

Leave a Comment