NMath license information is stored in a license key which must be found at runtime. When you purchase one or more developer seats of NMath, you will be issued a license key describing the terms of your license. As described in a previous post, beginning with the release of NMath 5.2 and NMath Stats 3.5, NMath includes a new configuration system for controlling the setting of the NMath license key.
An NMath license file is no longer used.
If no license key is found at runtime, a default evaluation license key is used which provides a free 30-day evaluation period for NMath on the current machine.
At development time, you will typically have NMath installed on your machine. To enter your license key into the registry:
- Open CenterSpace Software | License NMath from your Start menu.
- Enter your name, email, and license key, and click OK.
You can also specify your license key using various other mechanisms–by environment variable, by configuration app setting, and programmatically–in which case, any keys in the registry are ignored. These other mechanisms may be preferable in group development environments, and at deployment. (See below.)
During deployment, NMath will typically not be installed on the deployment machine. In this case, three mechanisms are supported for setting your NMath license key:
- by setting the
NMATH_LICENSE_KEY environment variable
- by setting the
NMathLicenseKey configuration app setting
- by programmatically setting the
LicenseKey property on class NMathConfiguration
Settings are applied in that order, and resetting the license key takes precedent over any earlier values. For example, here the environment variable is used:
> set NMATH_LICENSE_KEY="<your key here>"
This code uses an app config file:
<?xml version="1.0" encoding="utf-8" ?>
<add key="NMathLicenseKey" value="<your key here>" />
And this code accomplishes the same thing programmatically:
NMathConfiguration.LicenseKey = "<your key here>";
Note that if you forget to set your license key on a deployment machine, your code NMath code will work initially, using the default evaluation license, but this license will expire in 30 days.