View previous topic :: View next topic |
Author |
Message |
TimS
Joined: 11 Jan 2010 Posts: 3
|
Posted: Mon Jan 11, 2010 3:25 am Post subject: UninstallLicense |
|
|
Hi,
Evaluating the product, it's first use will be for a class library to ensure that it is only referenced by licensed developers.
I've added a Licensing class and applied LicenseProvider attribute, and the nag screen comes up every time I compile the sample console app - great.
I then entered a product key and it goes away - great.
Now I want to test it again with no valid license, and I'm using following code in a method called by the test app, and the license is not uninstalled.
(this code is in the class library as a test - I have no idea where the generated license data is)
EncryptedLicenseProvider.SetParameters(LICENSE_PARAMETERS);
EncryptedLicenseProvider provider = new EncryptedLicenseProvider();
provider.UninstallLicense(typeof(PlotFile.PlotFactory));
EvaluationMonitor evaluationMonitor = new RegistryEvaluationMonitor("TEST");
if (!LicenseManager.IsLicensed(typeof(PlotFile.PlotFactory)))
throw new Exception("UXLibrary not licensed.");
Please advise what I need to do/am doing wrong. |
|
Back to top |
|
|
TimS
Joined: 11 Jan 2010 Posts: 3
|
Posted: Mon Jan 11, 2010 10:09 pm Post subject: Re: UninstallLicense |
|
|
Ok, finding and removing the .LIC files was easy, and I've verified that that the license check when referencing the class library .DLL on another machine without a license works as expected.
But UninstallLicense still doesn't work! (in this case the .lic file is in the bin directory of the library, which I expect is default location). |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Jan 12, 2010 7:48 am Post subject: |
|
|
UninstallLicense just deletes the License file - so next time you use the component there will be no license.
The location of the license file is (by default) determined from the assembly path. The problem I think you are having is that the assembly used at design time and runtime are actually different. At design time the assembly is the one in the library bin directory. At runtime the assembly used is the one that is copied by default into the application bin directory. So when your application is running that is where it will look to delete the license file.
The solution is to derive your license provider class and override the GetLicenseDirectory method to return a fixed directory (typically under the CommonApplicationData directory). This is actually a good idea anyway to avoid issues when your component is placed in the GAC - as described in the following thread:
http://www.infralution.com/phpBB2/viewtopic.php?t=933 _________________ Infralution Support |
|
Back to top |
|
|
TimS
Joined: 11 Jan 2010 Posts: 3
|
Posted: Wed Jan 13, 2010 7:32 pm Post subject: |
|
|
Cheers, all under control now. |
|
Back to top |
|
|
|