I wonder what the purpose is of the licenses.licx file in a ASP.NET project. I can see in my commit history that the following lines were added in my last commit to the licenses.licx file:
Telerik.Web.UI.RadGrid, Telerik.Web.UI, Version=2019.1.115.45, Culture=neutral, PublicKeyToken=...
Telerik.Web.UI.RadAsyncUpload, Telerik.Web.UI, Version=2019.1.115.45, Culture=neutral, PublicKeyToken=...
Another developer asked me what difference those two added lines make to the project.
So what is the licences.licx file for and why were those two lines added automatically? I have read about it by Googling a bit but I haven't really grasped yet what the purpose of it is.
Thanks!
CodePudding user response:
From the EmptyLicensesLicx project readme:
When you are developing .NET applications that use third-party controls such as the ones that you can buy from Telerik or DevExpress for example, a mysterious file called
licenses.licx
appears inside theProperties
folder of your C# project (OrMy Project
folder if you're using VB .NET).This means that the third-party control uses the licensing model provided by the .NET Framework for licensing components and controls.
This file is a transitional file generated (and modified) by Visual Studio that participates in license checking. In design mode, Visual Studio uses this file to make a note of every licensed control you use in your design. When you then build your application, Visual Studio reads this
licenses.licx
file and for every control mentioned there, loads the relevant assembly and runs the license code in that assembly to see if the assembly is properly licensed (that is, that the product to which it belongs has been properly installed on that machine). If everything checks out, Visual Studio embeds the license key into the executable. If it doesn't, you'll get weird error messages about the control not being licensed (my favorite is "Could not transform licenses file 'licenses.licx' into a binary resource.
").The
licenses.licx
is a file automatically added to your project (if you cannot see it there, click Show All Files). Visual Studio uses a program calledlc.exe
to compile the licenses into embedded resources in your application, and when things go wrong with the license compiling process, you might see error messages referencing this executable.Here's an example of a line in a
licenses.licx
file:DevExpress.XtraCharts.ChartControl, DevExpress.XtraCharts.v15.2.UI, Version=15.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraMap.MapControl, DevExpress.XtraMap.v15.2, Version=15.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a Infragistics.Win.Misc.UltraButton, Infragistics2.Win.Misc.v8.1, Version=8.1.20081.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb Infragistics.Win.Misc.UltraGroupBox, Infragistics2.Win.Misc.v8.1, Version=8.1.20081.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb
Each line contains a reference to a type that is contained in an assembly, in a comma delimited list format. The first value is the full name of the class, the second is the assembly that contains the class, and the other values are part of the assembly's identity.