This document outlines how to license a LabVIEW library using the 'Set License Tag on Library' VI from the NI License Manager SDK and create a VI Package to distribute the licensed library.
- Install the NI License Manager SDK using VI Package Manager
- Create a library to license
- Request a license file from the NI Tools Network team
- The NI Tools Network team will create a license and return it to you along with a link to these instructions.
- Copy the license file to:
- C:\ProgramData\National Instruments\License Manager\Licenses
- Also, copy the license to your source code folder, for including with VI package later
- Create the Product Info XML File. The Product Info XML file defines the user-visible content of a license and contains information about a specific version of a package or family. To create this file, select Tools>>NILM Product Info XML Generator in LabVIEW to open the XML File Generator tool.
- Fill in the fields in the Product XML tab of the XML File Generator. Most of the fields in the Product XML tab are self-explanatory. The following list describes fields that might require additional explanation.
- Product Prefix – Name that is appended to the beginning of the XML filename. This will also be the text before the first underscore in the license file's package name. For example, if the package name is "NILMExample_Addon_PKG" the product prefix would be "NILMExample".
- Product Version – The version of the product. The format for this field must be nn.nn.nn. The XML File Generator appends the product version to the end of the XML filename.
- This is or will be an in-place upgrade of another version – Select this option to replace the version of the product that you specify in Base Upgrade Version with this product.
- Click Save Product XML File and save the Product Info XML file to:
- C:\ProgramData\National Instruments\License Manager\ProductInfo
- Also, copy the Product Info XML file to your source folder, for including in the VI Package later
- Bind the license file to your library. Download ‘NI License Manager Library Binding Utility‘ tool from VIPM and fill the following information:
- A path to the library
- The name of the license string used when creating license file. To locate this string:
- Open the .lc file using Notepad and look for the COMPONENTS=" " tag. The value for this tag is the 'Component name' and the license version needs to match the version in the license file, (e.g. 1.0000 in the .lc file would be 1.0.0 and 2.0100 would be 2.0.1).
- For example, given the following text from a test license file
PACKAGE NILMExample_Base_PKG nilm 1.0000 COMPONENTS="NILMExample_Base" SIGN=635DBBCAACEC
The 'License String for Library' value would be NILMExample_Base:1.0.0
- The Display Name is what the user will see if the license ever expires and errors are reported indicating the user needs to activate it.
- Passwords (old & new) for the library. These are used to lock the contents of the licensed library by you, the developer. These are not to be shared with customers. Only provide an "old" password if you are changing the password of a library that has already been licensed.
Alternative way to do this is to open ‘Set License Tag On Library’ from the NI License Manager API for LabVIEW palette or by running it from a LabVIEW diagram.
- Ensure you have appropriate registry keys on the development machine.
- Open the "PostInstall.vi" example attached to this document. It's what your package file will run after completing the installation of your product. Notice in the block diagram that it creates a registry key for the product, in the appropriate registry directory, and creates 3 string values for that key called LicenseVersion, ToolkitFeatureName, and ToolkitFeaturePKG. We want to replace those on the development machine.
- If not already present on your development machine, create this registry key and 3 string values under HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\National Instruments\LabVIEW\AddOns\
- The registry key's value should be the name of your product
- The value data of the string value LicenseVersion should be the version present in your license file (e.g. 1.0.0)
- The value data of the string value ToolkitFeatureName should be the component in your license file (e.g. NILMExample_Base)
- The value data of the string value ToolkitFeaturePKG should be the package in your license file (e.g. NILMExample_Base_PKG)
- Now open NI License Manager and activate the software using the test serial number, P12A00413.
- Note: Without first activating the license on the development machine VI Package Manager will block the user from building a package containing licensed code.
- Create a VI Package to distribute licensed library.
- Include the License File and the Product Info XML file when creating your VI Package by adding the licenses and productinfo destinations in VI Package manager and setting them as install destinations specifically for the license file and product info XML file. Installation locations are:
File
|
Install Location
|
License (.lc) file
|
C:\ProgramData\National Instruments\License Manager\Licenses
|
Product Info XML (.xml) file
|
C:\ProgramData\National Instruments\License Manager\ProductInfo
|
Note: Make sure that an activated license file from a different machine is not transferred to the machine where the licensed library is being packaged.
Now, you need to go to Source File Setting in the VI Package Builder and change the Destination of the license file from the default (Toolkit VIs) to Licenses and the Destination of the xml file to Product_Info. If you don't do this, the license file and xml file won't be copied to the correct location. See example below:
- If you have not already, create the registry keys required by LabVIEW for checking licensing status during launch. Please refer to the attachments for an example packaged toolkit. Also attached below are examples for the Custom Action VIs needed to create & remove NI License Manager registry keys on install & uninstall of the package. These Custom Action VIs will need to be modified with your product and license information and added to your package.
- Note: The registry keys trigger LabVIEW to check the license status for the add-ons during launch in order to display the activation dialog to customers. Not adding these registry keys would still allow customers to activate licenses through NILM and the code would still be protected in LabVIEW. Only, the licensing dialog would not be presented to customers when launching LabVIEW.
- You will need to update the block diagram of the PostInstall VI so the registry key information it creates will match your product:
You will need to update the block diagram of the PostUninstall VI so the registry key information it deletes will match your product:
- After these have been updated, use the VI Package Manager Pre/Post Build Actions tab to point to the appropriate custom action VIs, being sure to include PreInstall, PostInstall, and PostUninstall. After you have pointed to these files, build a package.
- Finishing configuring your package to comply with the Tools Network requirements. Then test the installation and activation process using a clean system or virtual machine.
- Submit the package to NI Tools Network team for review before publishing.