Free Support Forum - aspose.com

Handling license for Aspose.Cells to avoid error "Cannot find license 'filepath'" in VB.NET

Hi,


I recently upgraded my Aspose.Cells .dll file from version 4.9 to the newest version. I have my license file (Aspose.Total.lic) in the /bin/debug/ folder of my directory. I have a ton of existing code in which I check if the license file exists in that folder (returns true), then i use the method -

license.SetLicense(basePath & “\bin\Aspose.Total.lic”) where the basePath is the bin/debug directory. When calling this method, I receive the error - “Cannot find license” even though the File.Exists(path) returns True and I see the license file in my solution directory. This is happening ever since I updated to the newest .dll version. Is there something I need to change when updating to a newer Aspose.Cells version for this to work (something with the license?)

Please advise

Thank You

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

You must set the license before using any other Aspose.Cells API(s). So please make sure, you are setting the license first and then using other API(s).

Besides that, each Aspose component has its own license class, so make sure you are setting the license of Aspose.Cells separately with its own license class. For example, Aspose.Cells license class’s full name is Aspose.Cells.License.

Please place your license file in any directory, let’s say, you place your license file in c:\mydir, then the license file path will be c:\mydir\Aspose.Total.lic.

Once, you have right file path, then you can set your license using the following code.

C#


string licPath = @“c:\mydir\Aspose.Total.lic”;

Aspose.Cells.License lic = new Aspose.Cells.License();

lic.SetLicense(licPath);

Hi,


I am still having the same issue. My code is as folllows -

Dim license As Aspose.Cells.License = New Aspose.Cells.License
If System.IO.File.Exists(basePath & “bin\Aspose.Total.lic”) Then
license.SetLicense(basePath & “bin\Aspose.Total.lic”)
End If

- The basePath is the bin\Debug directory for my solution (it is verified and correct)
- It enters the conditional which means it found the license file (which also means the
path is correct)
- I also have this code in the watch window -
System.IO.File.Exists(basePath & “bin\Aspose.Total.lic”)
and it is True up until it executes the SetLicense method, then strangely it
changes to False
- The error that displays when trying to execute reads -
“Cannot find license C:\filepath”

*This line of code has worked for years up until I upgraded to the latest version of Aspose.Cells from version 4.9

*So, there has to be an issue with the .dll for the newer Version (7.4.0.1)

*Maybe the license file is not compatible with the new version?

Any help or suggestions would be greatly appreciated

Thank You

Hi,

Thanks for your further input.

Since you have upgraded to new version and your license is more than 1-year old, so your license is incompatible with the new version.

Now, you will have to either get a new license by renewing your license subscription or you will have to use your existing license and existing code without upgrading to new version.

If you still want to upgrade your code, then please contact Aspose.Purchase department and purchase a new license for yourself.

Hi,


Our company’s license actually expires in June of this year, so it is still good. I have tried to place the license file in other directories and I still receive the same error. This code is being called from a web app, does that maybe have something to do with it? The funny thing is that I created a console application with the same logic, the same license file and it works just fine, doesn’t make any sense. Any other suggestions

Thanks

Hi,

Thanks for your feedback.

In this case, please make sure, you are setting license before using any other Aspose.Cells APIs. The very first code to be executed should be setting a license.

And please also make sure, that you are setting license with Aspose.Cells.License class, because there are other classes too e.g Aspose.Words.License, Aspose.Slides.License etc.

And in case of ASP.NET web pages, you should set license inside Page_Load or Application_Start event.

Ok, I tried moving the setting of the license code to other places - page load, etc. no luck, still the same error. I tried, removing version 7.4 dll and replaced it with the 4.9 dll and it works again, so there is something going on with the 7.4 version.

On a side note, like I had said in a previous post, I know for a fact that the License file exists in that folder because I did a File.Exists(‘filepath to license file’) and it returned True. Also, our license is not expired, I am using the Aspose.Cells.License class, I set the license before I use any of the Aspose API’s and it worked in version 4.9. I know it is probably difficult to debug this sort of issue, but I am not sure what else to do. Any more suggestions would be helpful.


Thank You

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

In order to investigate this issue further, please send us your license file. Please do not attach the license file at this thread.