New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

How To Fix License File Related Errors

Sometimes when upgrading a Web Site or Web App project to a newer version of Telerik.Web.UI.dll assembly, you may experience license file (licenses.licx) errors like the ones below, which may prevent the compiler to build the solution:

DESCRIPTION

As of Q1 2015, the Telerik ASP.NET AJAX uses the standard .NET licensing mechanism, which when adding the Telerik controls in design-time causes Visual Studio to add a license.licx file to the solution. Its purpose is to:

  • combat copyright infringement.
  • provide license holders in the company with statistics on the use of the available licenses.
  • send anonymous statistics about the controls usage. The structure of the Licenses.licx file is similar to:
Telerik.Web.UI.Rad<Control_Name>, Telerik.Web.UI, Version=<Version_of_Telerik.Web.UI.dll_Assembly>, Culture=neutral, PublicKeyToken=121fae78165ba3d4
...
Telerik.Web.UI.RadGrid, Telerik.Web.UI, Version=2015.1.401.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4
Telerik.Web.UI.RadCalendar, Telerik.Web.UI, Version=2015.1.401.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4

and enlists the Telerik ASP.NET AJAX components used in the application and their fully qualified names.

The default location of the LicenseFile.licx is:

  • Web Sites - in the root of the site
  • Web Applications - in the Properties folder of the project

If your project build fails with errors pointing to the license file, follow the instructions in the section below to resolve them.

SOLUTION

If you get errors related to the LC.exe (License compiler) as

Could not load file or assembly

LC : error LC0000: 'Could not load file or assembly 'Telerik.Web.UI, Version=201x.xxxx.xx, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)' licenses.licx (1): Unable to resolve type 'Telerik.Web.UI.Rad, Telerik.Web.UI, Version=201x.x.xxxx.xx, Culture=neutral, PublicKeyToken=121fae78165ba3d4' Processing complist 'Properties\licenses.licx'... 12>C:\Projects<Project Name>\Properties\licenses.licx(3): error LC0004: Exception occurred creating type 'Telerik.Web.UI., Telerik.Web.UI, Version=201x.x.xxxx.xx, Culture=neutral, PublicKeyToken=121fae78165ba3d4' System.MissingMethodException: Constructor on type 'Telerik.Web.UI.' not found

or

Could not load file or assembly 'Telerik.Web.UI, Version=20xx.x.xxx.xx, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. Invalid pointer (Exception from HRESULT: 0x80004003 (E_POINTER))'

you can solve them by:

  • Since the error could happen if the installed .NET Runtime assemblies are different than the project's configured .NET Runtime (targetFramework), make sure that the targetFramework of the app matches the .NET version of the Telerik Web UI assemblies. If the app is built against .NET 4.0, use the Telerik assemblies built for .NET 4.0 (in the manual installation they reside inside the Bin40 folder, for NET 4.5 and above, use the assemblies in the Bin45 folder). One way to test if this is the cause of the issue is to double-click on the error in the Visual Studio Output window which will open the file with the error. Upon opening the file, Visual Studio will then do some thinking and then the error will disappear.
  • Another reason for the error is the existence of old versions of the Telerik assemblies declared inside the licenses.licx file. Open the file and Delete the contents of the license.licx and making it read only.
  • Alternatively, you can also delete the whole license.licx file and rebuild
  • Or right-click the Telerik.Web.UI.dll file in Windows Explorer, select Properties, and then click the 'Unblock' button on the General tab near the bottom.
  • Or if your app is under the source control to make it ignore the license file so any changes on a developer machine won't make it into the build machine or anywhere elsewhere.

A customer report indicates that if the reference errors persist after following these steps, the solution was to re-install the NuGet package microsoft.bcl.build.

If the above does not help:

Alternative NuGet solution

The EmptyLicensesLicx is a third-party NuGet Package solution which ensures that the empty license.licx is present and working in Visual Studio.

For details of why the error occurs see the readme on the GitHub project. The developer behind the project does a wonderful job of breaking down the problem and solution.

Missing Licenses licx file

If for some reason the license.licx file is missing and you are getting build errors because of it, you can rebuild the application and it should be recreated. Another approach is to create an empty license.licx file in the root of your Web Site or in the /ProjectName/Properties folder, if you are developing a Web Application project.

License file is not updated and contains information for older versions of the controls

If for some reason the licenses.licx file is not updated properly, you can delete its contents and rebuild the application.

Task could not find LC.exe using the SdkToolsPath

If you get the Task could not find "LC.exe" using the SdkToolsPath error during automated MS Build tasks, review the Telerik MSBuild Task could not find “LC.exe” using the SdkToolsPath blog post by Matthew Sigman. Essentially, you should either install Windows SDK on the build machine, or add the /p:GenerateSerializationAssemblies=Off flag to the build arguments.

Could not transform licenses file into a binary resource

The issue is discussed in the following MSDN article: Could not transform licenses file 'file' into a binary resource. .

Source Control Issues

  • Unwanted check out of the project and solution files - After opening the Visual Studio designer, the licx file checks out the proj/sln file from source control, which may be annoying.
    • Preventing .NET from properly updating the file - the source control integration could prevent .NET to properly update the licenses.file (e.g., it may be read-only)

The solution for the above issues is to:

  • Delete the contents of the license.licx
  • Check in the file
  • Make the source control ignore the license file so any changes on a developer machine won't make it into the build machine or anywhere elsewhere.

Getting a trial error message when refreshing the page

The "Thank you for using the Trial Version of Telerik® UI for ASP.NET Ajax to build more powerful applications faster. Purchase the Commercial Version now to get access to all product updates and the Telerik expert support." error is not directly related to the Licenses.licx file functionality, but to that the Telerik.Web.UI.dll is a trial build for demonstration and trial purposes only. You can check the articles below to see how to remove the trial error:

In this article
Not finding the help you need? Improve this article