基于 Licenses.licx 的 .Net 组件许可模型如何工作?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51363/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 09:46:38  来源:igfitidea点击:

How does the Licenses.licx based .Net component licensing model work?

.net

提问by Gishu

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.licxis created - with what appears to be justthe assembly full name/identifiers. This file has to be included when the client assembly is built.

我遇到了多个使用许可方案的第三方 .Net 组件供应商。在评估副本上,组件显示为带有 nag-screen 或水印或某些此类指示符。在获得许可的机器上,会创建一个Licenses.licx- 看起来只是程序集的全名/标识符。构建客户端程序集时必须包含此文件。

  • 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
  • 这个模型是如何工作的?从组件供应商和用户的角度来看。
  • .licx 文件的用途是什么?是否应该办理登机手续?我们在签入错误/正确的 .licx 文件时遇到了许多问题

采纳答案by aksangrav

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

几乎所有关于 .Net 许可的内容都在这里解释。没必要重写,我想。

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.

希望这可以帮助。

回答by logicnp

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.

那不正确。licx 文件非常重要,对于使用嵌入其中的正确许可证信息构建主机应用程序是必要的。因此,将 licx 文件也包含在源代码管理中至关重要。否则,在另一台机器上检出源代码的人将无法获得 licx 文件,并且构建可能会失败或没有 exe 中使用的组件的正确许可证信息。

回答by Denis

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.

为了部署具有许可组件(如 TX Text Control)的应用程序,必须正确许可 EXE 文件。

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

.NET 许可机制建议将许可证添加到 EXE(调用程序集)。

---- 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.

如果将 TextControl 从 Visual Studio 工具箱拖放到窗体中,Visual Studio 会创建一个 licenses.licx 文件并包含许可证信息。此文件与您的项目文件位于同一文件夹中。

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:

重要提示: licenses.licx 文件不包含许可证字符串本身。它只包含有关许可组件的信息。对于 TX Text Control (TXTextControl.TextControl),添加以下字符串:

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.

如您所见,它包含命名空间和控件名称、程序集版本、文化信息和唯一的公钥标记。基于该信息,许可证编译器 (lc.exe) 编译将嵌入到可执行程序集中的真实许可证字符串。lc.exe 是 Visual Studio 在构建过程中使用的 .NET Framework SDK 的一个小实用程序。

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

---- 如果我在用户控件中使用 TX Text 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.

在这种情况下,您还需要将许可证添加到主可执行文件中。因此,您可以简单地将 TextControl 拖放到主项目的虚拟窗体中,以便自动添加 licenses.licx 文件和引用。

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.

之后,您可以再次从该表单中删除 TextControl。或者,您可以简单地将 licenses.licx 文件复制或创建到主项目文件夹。在这种情况下,您还需要手动添加对 TX Text Control 的引用。