How to set license string in AVBlocks

This post assumes that you are using AVBlocks for .NET and you have purchased a license from the License Management site.

When you license a Primo Software product you usually get a license file in the email. The license file is basically a signed XML string that describes the products and features you have licensed. Then you have to provide the license to AVBlocks with the Library.SetLicense method.

Here is a code snippet in C#:

const string license = 
      <license version='1.0'>
        <updateTime>2013-05-23 21:02:44</updateTime>
        <item id='avb-win'>
          <feature id='h264-enc' />
          <feature id='pcm' />


The license above is for AVBlocks for Windows (‘avb-win’) and includes the [AVC / H.264 Encoder] (‘h264-enc’) and [PCM Audio] (‘pcm’) features.

Then the following calls should return true for the license above:

Library.IsLicensed(null, null);
Library.IsLicensed(null, "h264-enc");
Library.IsLicensed(null, "pcm");
Library.IsLicensed("avb", "h264-enc");
Library.IsLicensed("avb", "pcm");


  1. Calling Library.SetLicense on any of the AVBlocks Demo libraries will fail. The Demo version cannot be licensed. If you downloaded AVBlocks from then you have the Demo product. You need to get your AVBlocks copy from the Downloads section of the License Manager site.

  2. You should be careful when formatting the license XML as it may become invalid.

Here are the rules:

  • It’s OK to reformat the blank space between the xml elements in the license (spaces, new lines) the way you wish.
  • It’s also OK to substitute the double quotes with single quotes (as shown in the example above), otherwise you need to escape the double quotes.
  • It’s NOT OK to reorder elements or change the letter case.

Blog Comments powered by Disqus.