How to Embed License as Resource?

I am trying to embed the license as a resource, but have not found any code to do this except for the following. What code would one use to set it to an item in My.Resources? I tried the following code

Dim license = New Aspose.Slides.License()
license.SetLicense(licenseStream) ’ It does not like it when I add the name of my embedded resource.

  • In Visual Studio, include the .lic file into the project using the “File | Add Existing Item…” menu.
  • Select the file in the Solution Explorer and set “Build Action to Embedded Resource” in the Properties window.
  • In your code, invoke SetLicense that passes only the short name of the resource file

@brosello,
Thank you for your inquiry.

To use My.Resources, you should perform another way to add the license file as the resource:

  1. In Solution Explorer, click the right button on your project and select Properties.
  2. Go to Resources and click on Add Resource / Add Existing File… add_resource.png (27.2 KB)
  3. Select the license file and open it for adding to resources.
  4. Rename the resource AsposeLicense, for example.

After these steps, you can read the license like this:

Dim licenseData = My.Resources.AsposeLicense
Dim licenseStream As New MemoryStream(licenseData)
1 Like

Thanks for the prompt response to this question. I will try it and let you know. Thanks again.

Andrey,

                That worked perfectly. Thanks.