License as embedded resource

Hi,

I have two projects in one solution in Visual Studio. One class library, and one website. I have added “Aspose.Total.lic” to my ClassLibrary as an embedded resource, and it’s placed in the directory “Resources”. This is described in http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/including-the-license-file-as-an-embedded-resource.html

When I compile the project, I can find the license file in the class library dll using Red Gate’s Reflector tool as: ClassLibrary/Resources/ClassLibrary.Resources.Aspose.Total.lic.

In Global.asax in the website i try to set the license:
Aspose.Network.License lic = new Aspose.Network.License();
lic.SetLicense(“Aspose.Total.lic”);

I get the error: System.IO.FileNotFoundException: Cannot find license ‘Aspose.Total.lic’.

What am I doing wrong?

Hi,

Thanks for considering Aspose.

In this case, you are adding the license as embedded resource in the “class library”. So, if you set the license using above code in the “class library” project, it would work.

If you want to set the license when the web application starts (i.e. global.asax), please try the following steps:

  • Create a method in your class in “class library” that sets the license using the same code above.
  • Add a reference to the “class library” in your website project
  • In global.asax, call the above method

Ah, thank you for quick reply.

That would do the trick, thanks. :slight_smile:

I tried the link in this thread to set the license as an embedded resource but the link did not work, I imagine because the thread is quite old. Could you provide me the link to the instructions on how to do this?

Thanks
Luis


Hi Luis,


Please visit this link for using license as embedded resource and let us know if we can be of any help to you.