53

I've encountered multiple third party .Net component-vendors that use a licensing scheme. On an evaluation copy, the components show up with a nag-screen or watermark or some such indicator. On a licensed machine, a Licenses.licx is created - with what appears to be just the assembly full name/identifiers. This file has to be included when the client assembly is built.

  • How does this model work? Both from component-vendors' and users' perspective.
  • What is the .licx file used for? Should it be checked in? We've had a number of issues with the wrong/right .licx file being checked in and what not
Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
Gishu
  • 134,492
  • 47
  • 225
  • 308
  • 2
    My answer is not really an answer - I'd just like to provide a link to an article that discusses the problem of whether or not to check licnses.licx files into the repository. http://community.devexpress.com/blogs/ctodx/archive/2009/03/06/licenses-licx-file-woes.aspx In particular, see the various comments added to the blog article. – RenniePet Aug 02 '11 at 13:14

3 Answers3

24

That's not correct. The licx file is very important and is necessary for the host app to be built with the correct license info embedded in it. So, its critical that the licx files be also included in source control. Otherwise a person checking out the source code on another machine will not get the licx file and the build may fail or not have the proper license info for the used components in the exe.

logicnp
  • 5,796
  • 1
  • 28
  • 32
  • 1
    Or, arguably, the machines building the source should have appropriate licenses in which case distribution is not needed... ? –  Jun 18 '12 at 22:16
  • 1
    I don't understand what is not correct. Maybe it was a reference to another answer? The rest of the answer stands on it's own. – madth3 Nov 23 '12 at 18:37
  • 2
    "Or, arguably, the machines building the source should have appropriate licenses" -- Doing it that way causes the license information to be omitted from the resulting executable, and without that, depending on the control, the control may not be functional. It will probably work on the development systems, where that control is licensed system-wide, but probably not on end-user systems that don't have a licensed version of that control. –  Mar 17 '15 at 08:02
  • Including the license.licx can cause issues on build servers, because then the control needs to be installed there as well; which is often not possible. Therefore you DON'T add the licx file, instead you manually build the .licenses file and add that as an embedded resorce to the project. – L-Four May 20 '20 at 05:20
14

Almost everything about .Net licensing is explained here. No need to rewrite, I think.

It is better to exclude license files from project in source control, if you can. Otherwise, editing visual components may be pain in the ass. Also, storing license files in source control repository is not a need.

Hope this helps.

vgru
  • 49,838
  • 16
  • 120
  • 201
aksangrav
  • 322
  • 3
  • 6
  • 8
    Nowhere in that entire article is "licx" mentioned. How does this address the question? – Joe White Dec 10 '10 at 20:41
  • 2
    I somewhat agree with Joe White. It does explain licensing and infer what licx might do but doesn't directly address it. – xr280xr Jul 01 '11 at 17:56
  • The new url of the article is https://www.developer.com/microsoft/dotnet/applications-licensing-using-the-net-framework/ an archived version of the original article is at https://web.archive.org/web/20170227185258/https://www.developer.com/net/csharp/article.php/3074001 – Nils Jan 10 '23 at 13:06
10

This was a good article on the topic: Click Here

In order to deploy an application with licensed components like TX Text Control, the EXE file must be licensed properly.

The .NET licensing mechanism recommends to add the licenses to the EXE - the calling assembly.

---- What happens in detail?

If you drag and drop a TextControl from the Visual Studio toolbox to a form, Visual Studio creates a licenses.licx file and includes the license information. This file is located in the same folder like your project file.

Important: The licenses.licx file does not include the license string itself. It just contains information about the licensed components. In case of TX Text Control (TXTextControl.TextControl), the following string is addded:

TXTextControl.TextControl, TXTextControl, Version=15.0.700.500, Culture=neutral, PublicKeyToken=6b83fe9a75cfb638

As you can see, it contains the namespace and control name, the assembly version, culture information and the unique public key token. Based on that information, the License Compiler (lc.exe) compiles the real license string that will be embedded into the executable assembly. The lc.exe is a small utility of the .NET Framework SDK which is used by Visual Studio during the build process.

---- What if I am using TX Text Control in a user control?

In this case, you need to add the license to the main executable as well. Therefore, you can simply drag and drop a TextControl to a dummy form of the main project, so that the licenses.licx file and the references are added automatically.

After that, you can remove the TextControl from that form again. Or you can simply copy or create a licenses.licx file to the main project folder. In this case, you need to add a reference to TX Text Control manually as well.

Denis
  • 11,796
  • 16
  • 88
  • 150