Free Support Forum -

Referencing and setting the license in

Hello, I just purchased Aspose.Cells.Net and have some problems referencing the Aspose.Cells.dll. I use VB.NET in MSVS-2010. I installed the Aspose.cells component using the installer method with out any problems and then rebooted. I tried to add a reference to the component per the instructions using the “Add Reference” window and the “.NET” tab. The Aspose.Cells component is not listed as a component in add reference window. Then I selected the “Browse” tab and referenced the aspose.cells.dll directly.

1. Why doesn’t the Aspose component show up in the “Add Reference - .NET tab”?
2. Did I reference the component properly using the browse tab? Should I do it differently?

In my application in Form1 I tried to set the license and added the following under Public Class Form1:

Public Class Form1
'Instantiate an instance of license and set the license file through its path.
Dim license As Aspose.Cells.License = New Aspose.Cells.License()
license.SetLicense(“Aspose.Cells.lic.xml”) '<-- I tried the whole path also.

For the word “license” in “license.SetLicense” Visual Studio gives me the warning “declaration expected” - why?

3. Why so I get the warning/error for the license object above?
4. What if any steps am I not doing correctly?


Hi Terry,

Thank you for using Aspose product.
For your first question regarding "Add Reference" issue, please follow the link below for details.

For your second question regarding License class issue, you have to import the namespace before using it.

Please use “Imports Aspose.Cells” statement into your code before writing any other code segment. Another thing to remember that there is another License class present in System.ComponentModel namespace. So, to avoid "Ambiguous name" error, use the fully qualified class name i.e.

Dim objLicense As Aspose.Cells.License = New Aspose.Cells.License()

If you face any difficulty, please feel free to contact us.


Thanks for your quick response. I have three follow-up questions for you.

1. The URL link you gave me regarding the “Add Reference” issue is the same link I used to guide me but I don’t see Aspose in the reference list. Please note that I downloaded and installed the latest Aspose.Cells component version 5.2.0 first and then tried to find the Aspose reference under the .NET tab, but it is missing. Shouldn’t the Aspose installer add some keys or something to the windows registry and therefore a reference should show up under the .NET tab in Visual Studio? The Aspose installer seemed to complete successfully. Right now I am trying to use the browse tab to directly reference the Aspose.Cells dll’s but I shouldn’t have to do that since I installed Aspose using the installer.

2. If I have to directly reference the Aspose.Cells dll should I reference the dll that is in the …\bin\net3.5_ClientProfile directory? I’m using VB.NET in Visual Studio 2010.

3. Finally, according to the instructions I only have to set my license once per application - is that correct? If yes, then where within applications do you suggest that be done? I’m referring to the program statement: license.SetLicense(“Aspose.Cells.lic.xml”). Also, is it correct that I do not need the full path as long as the license file is in the same directory as the dll?

Sorry if my questions are seem basic but I’m new to VB.NET and have to deal with a learning curve.

Thanks for your support.


1) Well, Aspose.Cells for .NET component would be listed in .NET tab if you are using VS.NET 2003, 2005 and 2008 versions. If you are using VS.NET 2010, you will not see the component by default in the .NET tab, you should add reference to Aspose.Cells.dll file browsing your directory.

2) You should use Aspose.Cells.dll file under “\bin\net2.0” directory. For Aspose.Cells.dll file present in “\bin\net3.5_ClientProfile” directory is for different purpose, i.e., when you need to create console application for .NET client profile as target framework. Please check readme.txt file for complete reference.
Also check the topic:

3) Yes, you need to set licensing code only one time per Application life cycle. The best location would be the place before using any other Aspose.Cells API, it means you may put the licensing code at the very start of your program. For a web application, you may place it in Application_Start or Session_Start events in Global.asax file in VS.NET, this would be the best place for a Web application.

Also, Aspose.Cells always tries to find the license file in the following locations:

* Explicit path
* The folder that contains Aspose.Cells.dll
* The folder that contains the assembly that called Aspose.Cells.dll
* The folder that contains the entry assembly (your .exe)
* An embedded resource in the assembly that called Aspose.Cells.dll

For a winform solution, you may add license file as an embedded resource.

Please check the document for complete reference:

Let us know if you still have any confusion.

Thank you.

Thanks, everything works now. The embedded resource method works the best for me.

Hi ,
I am using Aspose.cells componet. I have written the same code SetLicense method to apply the license before using the Aspose component. I have placed the in someother path and passing that path to the SetLicense Method. some times it is working ,but in some cases it is throwing file not found error. I have used HostingEnvironment.MapPath method to get the License path…can you help me on this.


Please see the reply and follow up your other thread for reference: