Word License

I got the company that I am consulting for to buy a license yesterday. After purchasing the lisense they downloaded an xml file. I named the xml file ASPOSE.WORD.LIC and saved it in the bin directory. I then placed the following code in the program:

Dim license As license = New license
License.SetLicense(Aspose.Wor.lic)

The app throws an error saying it does not support license. Am I missing a dll file or something? Please help!


Thanks

Can you please let me know the exact error message.

Error: Type ‘license’ is not defined.

Are the steps that I made correct?



Thanks

You do everything correctly, but you need to download the latest Aspose.Word version because the License class was just added a few days ago to support the new licensing scheme.

I reinstalled Aspose.Word. Now the app stops at License.SetLicense(Aspose.Word.lic) and says ‘lic’ is not a member of ‘Word’. Am I not missing a dll for this?


Thanks

You need to enclose Aspose.Word.Lic into double quotes because its a file name, right?

License.SetLicense(“Aspose.Word.lic”)

Alright now, but when I click the button that is supposed to pull up the report it says Cannot find license ‘Aspose.Word.lic’.

Please note that I have inserted the two lines of code in the button click event.


Thanks

If you look at the documentation for the SetLicense method, it describes the algorithm where the component looks for the license file. You either need to put the license file in one of those locations or specify full path to the license in the call to SetLicense. For example, License.SetLicense(“C:\MyLicense.lic”)

I have put my xml file on the bin directory and therefore I beleive I don’t have to specify the full path. Is the license file the same file as the xml file with serial number and stuff?


Thanks

Hmm. You must have an ASP.NET application and the DLL is copied to ASP.NET temporary cache and run from there (or maybe shadow copying). The licensing code must be trying to find the license in the shadow copy directory and the license file is of course not there.

As one workaround you can specify full path. As another workaround you can add the license file to your project as content file and it could be copied to the shadow directory too (although I'm not 100% sure on this one). In the meantime I will have a look at the licensing code to make sure it will search in the original, not in the shadow copy folder.

Another thing you can do is to add the license file to your application as an Embedded Resource, our licensing code will find it there.

I kept the file in the bin and added the file extension (.xml) in the SetLicense method and it worked like magic. Thanks for all your help!

I’ve also checked and confirmed that if you plase the license file into the bin folder of an ASP.NET application it works fine even with shadow copying or ASP.NET cache or whatever. Just make sure the name of the file you pass to License.SetLicense matches the name of the license file and it will find it okay.

We’re experiencing the same error (Cannot find license ‘Aspose.Word.lic’. ) when we deploy to a production server. It runs fine when it’s on our Delopment and QA servers.

The license file (Aspose.Word.lic), the component (Aspose.Word.dll) and the calling assembly are all located in the \bin folder of the ASP.NET application.

Can you offer any other suggestions?

One thing you can do is embed the license into the assembly that calls Aspose.Word as an embedded resource.

That did the trick – thanks!!