This series of articles will show how to use tools available on the market to control licensing of plug-ins for Autodesk products. This is important to most commercial developers and if you are developing for the Autodesk Exchange Store, you noticed that no license system is provided, only a payment method. We’re not testing, validating or certifying the protection system and how hard it’s to (or not to) break it.
For this demonstration, we’ll use a .NET plug-in developed for AutoCAD, but the same idea can be applied to other .NET based APIs, like Revit and Inventor. Most of the code came from the samples available with the tool.
Now moving forward, this post will show the Infralution License System, winning of the 2009, 2010 and 2011 Members Choice of the Code Project development resource site. This tool is available for trial during 30 days and the prices start at $170 US dollars.
Between the benefits:
- just a few lines of code added to any command on the plug-in, as will be shown on the sample;
- single .NET reference required that will enable all license features;
- supports obfuscation, although this feature is not included, but there is another tool .NET Encryptor from the same provider.
- interesting sales management feature;
- support trial, mandatory feature for Autodesk Exchange Store, where every plug-in must immediately work after downloaded;
- authentication can be done online;
Of course, for AutoCAD environment, some cons:
- the solution is .NET based and therefore will only work for Windows platform;
- no C++ or Lisp support;
- requires reference to Windows Form, which can affect AutoCAD console;
To test the Infralution, download the installer from here. Install it and launch it. Go to File menu, then New, then Product. Fill with your plug-in information, such as name, but note that the ‘Product Password’ field is disabled during trial, which must be a unique and hard to guess value. Then click on ‘Generate Validation Parameters’ to create the LICENSE_PARAMETERS variable value.
This sample code is based on the sample available at C:\Program Files (x86)\Infralution\Licensing System 5\Samples\VS2010\C#\LicensedApp folder and have, at the beginning, the code required to check the license. The value of the variable LICENSE_PARAMETERS must be replaced with the one generated when the product was created on the ‘Infralution License Tracker’.
Remember to adjust the TrialDays property. If you plan to deploy at the Autodesk Exchange Store, it is required to have a few days of trial, but the number is your business decision. At the bottom, the LICENSEDTESTPLUGIN custom command will require the license.
// Infralution namespace
// AutoCAD namespaces
public class Commands
/// License paramters
/// Generated using the Infralution License
/// Tracker (after create a new product)
private const string LICENSE_PARAMETERS =
/// License file
private static string _licenseFile =
/// License provider
private static EncryptedLicenseProvider
_licenseProvider = new EncryptedLicenseProvider(
/// Loaded license, if any
private static EncryptedLicense _license;
/// Helper function to get the path of the license file
/// <param name="dllName"></param>
private static string GetPathForDLL(string dllName)
string currentAssemblyLocation =
string currentAssemblyPath = System.
public static bool Licensed
_license = _licenseProvider.GetLicense();
while (_license == null)
// For this tests, I'm using the evaluation
// version of the infralution there the
// password cannot be changed
EvaluationMonitor evaluationMonitor = new
EvaluationDialog evaluationDialog = new
// Fully functional for 5 days
// It's required for the Exchange Store that
// any application is fully function at download
// time, even for a short trial period
evaluationDialog.TrialDays = 5;
// Execution delayed after 5 days, but only
// during 1 extra day
evaluationDialog.ExtendedTrialDays = 1;
evaluationDialog.ExtendedTrialDelay = new TimeSpan(10000);
// Application name that will appear on the dialog
// Using the same name used when creating the product
// on the Infralution License Tracker
evaluationDialog.ProductName = "AutoCAD_Infralution";
// Show the license dialog
EvaluationDialogResult dialogResult =
// Exit the app
if (dialogResult == EvaluationDialogResult.Exit)
// Exit the loop
if (dialogResult == EvaluationDialogResult.Continue)
// Install the license
if (dialogResult == EvaluationDialogResult.InstallLicense)
EncryptedLicenseInstallForm licenseForm = new
_license = licenseForm.ShowDialog(_licenseProvider,
public static void CmdMyTestCommand()
if (!Licensed) return;
// If is licensed, show a message
Editor ed = Application.DocumentManager.
ed.WriteMessage("\nI'm working now");
After NETLOAD and run the command, it will show the License dialog, like below. Although it would be possible place this license dialog on start-up (i.e. during IExtensionApplication.Initialize execution), this is not recommended. Remember that your application is one of several applications the user can have installed, and show this during AutoCAD start-up/launch can stop the process, slowing the start-up process.
Now to generate the license, go back to Infralution License Tracker, create a New Customer.
Then finally at New Sale menu, select the product and the customer, and finally click on ‘Generate’ to create the license key. This key can be sent to the user to license the application.
It is also possible to do some online activation. For that, it is required a online website running ASP.NET. Just like offline activation, when the user runs the command it will require a key, but the license framework will automatically go online and check it, avoiding duplicated activation.
Have used this solution before? Have used any other solution? Please share your experience, we can create an article on it.
Next article will discuss the Crypto tool.