We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unable to load embedded license when compiled in release mode

Hi,
Ihave a strange problem: When compiling my project in debug mode, the embedded license gets loaded without any problems (in Application_Start). However, as soon as I compile in Release mode, I get an “Cannot find license ‘Aspose.Cells.lic’” error (System.IO.FileNotFoundException).

If I copy the license file into the directory where the dll resides, it’s working in release mode.

Are there any special considerations when compiling in release mode and using embedded resources?


Hi,


The error: ““Cannot find license ‘Aspose.Cells.lic’” error (System.IO.FileNotFoundException).” is a .NET’s IO error, please make sure that the path is valid (you got sufficient rights to access it) and license file is there and your code is processed.

If you still find any issue, kindly attach a sample project (without your license file), zip it and post it here, we will check it soon.

Also, we recommend you to kindly use our latest version v7.3.1.

Thank you.

As stated in my initial post, this is about the licence file as embedded resource. When I put the file on disk, I don’t have any problem. But when included as embedded resource, it works when compiled in debug mode, but not when compiled in release mode.

Is there anything different about the license checking when compiling in release mode?

I already tried with v7.3.1.

Hi,


Well, nothing different regarding license whether to compile in debug or release mode,

If you have set your license file as embedded resource for your application, you may just try to change the license file’s path string to the fully qualified path with respect to namespace(s) and APIs hierarchy. e.g
.SetLicense(“MySolution.MyProject.Properties.Aspose.Cells.lic”) to check if it works fine for your case.

Thank you.

I included the license as described on one of your pages, by setting the build action to “Embedded Resource”.

I then retrieved the name of the resource by listing all the names of all resources like this (LinqPad):

Assembly myAssemblyList = Assembly.LoadFile(@“d:\pathTo\MySite.dll”);
string[] myResources = myAssemblyList.GetManifestResourceNames();
foreach (string resource in myResources) {
resource.Dump();
}

The name of the resource is “MySite.Aspose.Cells.lic”. When I use that as value for .SetLicense, I encounter the same issue as before: works when compiling in debug, does not work when compiling in release.
Hi,

Kindly attach a sample project "hello world" (without your license file), zip it and post it here, we will include a valid license file as an embedded resource to your project and run it to check your issue.

Thank you.

Hi,


We got the same issue. The problem occured when the “Enable Optimizations” checkbox was checked. It was not checked in debug mode but it was in release mode.

So to get it working, unckeck this checkbox.

Jsr

Hi,

Please download and try the latest version:
Aspose.Cells
for .NET v7.3.2.4

and let us know your run results.

Please provide us sample project and screenshot(s) illustrating how to replicating your issue at our end.

We will look into it and log it in our database if we noticed any problem.

The solution of unchecking the “Optimize code” checkbox (Properties -> Build Tab) worked for me as well in my VS 2015, .NET 4.6 Class Library.

Hi,

Thanks for sharing the solution and using Aspose.Cells.

We provide different types of Aspose.Cells like the one compiled on .NET 2.0, .NET 3.5 and .NET ClientProfile etc. Mostly .NET 2.0 can be used for any .NET Framework greater than 2.0 and if you are using .NET 4.6 then you can also use .NET 3.5 too.