您的位置:首页 > 其它

The following control could not be licensed: TXTextControl.TextControl解决方法

2012-08-27 15:48 3263 查看
In this blog entry, I would like to explain the required steps to force Visual Studio to compile a specific license into a .NET application. This article should help you, if you get the following error message in Visual Studio:

The following control could not be licensed: TXTextControl.TextControl

That means that Visual Studio could not find an appropriate license to validate the control. Generally, the license will be automatically included into the application and typically do not have to worry about licensing at all.

However, should you wish to do one of the following, it is necessary to take a closer look at licensing:

Create TextControl dynamically

Encapsulate TextControl in a user control

Update an existing project with a newer version of TX Text Control


Creating TextControl dynamically

Two significant steps are necessary in order to add the license of TX Text Control into an application. These steps must be performed when creating a TextControl instance dynamically:

The project must include a reference to the 'TX Text Control .NET for Windows Forms Component'. To include the reference, select Add Reference... from the Project main
menu in Visual Studio. Browse for 'TX Text Control .NET for Windows Forms Component', select it and confirm by clicking OK.

A 'licenses.licx' file must exist in the 'Properties' folder (C#) or the 'My Project' folder (VB.NET). To build such a file, create a new text file in this folder and name it 'licenses.licx'. Open the file and add the following string:

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

The 'licenses.licx' file is not a TX Text Control specific file, but a Visual Studio file that is used by 'lc.exe' (which is part of the .NET SDK) to compile the licenses into the assembly. These above steps are done automatically, if you drag and drop a TextControl
from the toolbox onto a form.


Encapsulating TextControl in a user control



If you wrap TextControl in a user control assembly, the license information must be in the calling application (exe). It is not sufficient that the user control contains a reference to 'TX Text Control .NET for Windows Forms Component'. Licenses can be only
compiled into executable files. The following diagram shows the dependencies:


Updating an existing project

Projects will be updated automatically, if only one version of TX Text Control is installed. If you have several versions of TX Text Control installed, perform the following steps:

Load your Visual Studio .NET project.

Open the Add Reference... dialog box in the Project... menu.

Delete the reference to the current TX Text Control version.

Add a reference to the new version and close the dialog box.

Open the licenses.licx file of your project and change the version number of the referenced TX Text Control version to the version number of the newer TX Text Control version.

Close the Visual Studio .NET development environment.

Reopen the Visual Studio .NET development environment.

Rebuild your project using the Rebuild Solution menu item.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐