"License cannot be granted" exception when you add a licensed user control to the Windows Form in the same solution (814342)
The information in this article applies to:
- Microsoft Visual Basic 2005
- Microsoft Visual Basic .NET (2003)
- Microsoft Visual Basic .NET (2002)
- Microsoft Visual C# 2005, Express Edition
- Microsoft Visual C# .NET (2003)
- Microsoft Visual C# .NET (2002)
SYMPTOMSWhen you create a licensed user control in a project, and
then add it to the Windows form in the same solution, you receive the following
exception: An exception occurred while trying to create an
instance of 'Projectname.Controlname'. The exception was "An instance of type
'Projectname.Controlname' was being created, and a valid license could not be
granted for the type 'Projectname.Controlname'. Please, contact the
manufacturer of the component for more information." However, when you
create a new solution, and then add the licensed user control to the Windows
form, the licensed user control is added. CAUSEAny user control that is implicitly added to the toolbox
refers the assembly file in the obj\Debug folder. Therefore, the licensed user
control that is created refers to the WindowsControlLibrary1.dll file in the
obj\Debug folder. Generally, the license (.lic) files are put in the Bin
folder. When you add an instance of a licensed user control to the Windows form
in the same solution, the license is validated. Because the .lic file is not
located in the obj\Debug folder, you receive the exception.RESOLUTIONTo resolve this problem, move the .lic file to the obj\Debug
folder. Follow these steps to resolve the problem described in the "More
Information" section of this article:
- On the Project menu, click Show
All Files.
- In Solution Explorer, open the bin
folder.
- Right-click
WindowsControlLibrary1.UserControl1.lic, and then click
Copy.
- Expand obj, right-click
Debug, and then click Paste.
- From the toolbox, drag UserControl1 to
Form1.
STATUS This
behavior is by design.
Modification Type: | Minor | Last Reviewed: | 10/3/2006 |
---|
Keywords: | kbvs2005applies kbvs2005swept kbLicensing kbWindowsForms kbCtrl kbControl kbprb KB814342 kbAudDeveloper |
---|
|