View previous topic :: View next topic |
Author |
Message |
maniac
Joined: 02 Jun 2006 Posts: 3 Location: Ahmedabad
|
Posted: Fri Jun 02, 2006 10:35 am Post subject: Licensing a Class Library |
|
|
I have a class library in .NET. i want to include licensing. When the class library is shipped to the user (developer), he should first enter the license key and then he should be able to access the classes and its access modifiers. for a control its possible.. but for a class library... i cant get a solution to it.
i want to check at design time and not runtime... coz the end user should not be prompted to enter the license. is there any method to access the compiler and check whether the license key is installed on the machine or not so that when the developer tries to build his application using our dll, he would get a message prompt to enter the license key.
What i did until now is wrote a code for Licensing in the constructor of one of the classes in my class library. but that wouldnt help when the end user uses the application. Apart from the Developer, the end user would end up entering the license.
Please let me know about the solution to it.
Thanks
Usman Suglatwala. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Jun 02, 2006 11:42 am Post subject: |
|
|
You should check for a license in the constructor of the class and display the licensing install form then. This provides a mechanism for the developer to install the license key. If the developer adds an entry to their license.licx file for your class then the Visual Studio license compiler will create an instance of your class and the EncryptedLicenseProvider will automatically create and store a runtime license in the resources for the application. When the application is run by the end the EncryptedLicenseProvider retrieves this key from the application resources and so the end user doesn't have to enter a key.
See the online help on licensing controls and components and the following FAQ for more info:
http://www.infralution.com/phpBB2/viewtopic.php?t=66 _________________ Infralution Support |
|
Back to top |
|
|
maniac
Joined: 02 Jun 2006 Posts: 3 Location: Ahmedabad
|
Posted: Fri Jun 02, 2006 1:54 pm Post subject: Licensing a Class Library |
|
|
Infralution wrote: | If the developer adds an entry to their license.licx file for your class then the Visual Studio license compiler will create an instance of your class and the EncryptedLicenseProvider will automatically create and store a runtime license in the resources for the application.
|
Thanks for your prompt reply. But i still have some confusion. Where will be the licenses.licx file created? I dont see any licenses.licx file being created in my project folder, which, in the case of Controls, get created. So you mean to say that developer has to manually create the licenses.licx file and then mention the class as it is mentioned for a control.
Thanks. |
|
Back to top |
|
|
maniac
Joined: 02 Jun 2006 Posts: 3 Location: Ahmedabad
|
Posted: Fri Jun 02, 2006 2:36 pm Post subject: Licensing a Class Library |
|
|
Hello,
I just added a Licenses.licx file in 'My Project' folder of My Root directory and included it into my Project.
and included the following Code:
Code: | ClsLibforLicenseCheck.ClsCheckLicense, ClsLibforLicenseCheck |
"ClsCheckLicense" is my Class where i have defined Licensing on the new constructor and "ClsLibforLicenseCheck" is my Class Library dll
I did not include the version information, neither the public key token. I get the following error on compilation.
Code: | Unable to resolve type 'ClsLibforLicenseCheck.ClsCheckLicense, ClsLibforLicenseCheck' |
Please guide me to a solution. Thanks.
[/quote] |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Jun 02, 2006 10:35 pm Post subject: |
|
|
Make sure that the Build Action for the licenses.licx file is "EmbeddedResouce" and that your application project contains a reference to the Class Library DLL. _________________ Infralution Support |
|
Back to top |
|
|
|