Am I allowed to package my license with my code, if so, how?

I have a single developer license and I assume the license can’t be used in more than one location by the function of the license. I wanted to hide the license file in the executable or package it with the rest of the .dll files etc so that it can’t be easily found by users, moved or modified.

@treecej,
Thank you for your query.

Yes, may package license with your product in order to use it without the trial limitations. For embedding the license please follow the steps given in the following article:

Setting a license using an embedded resource

One point which needs consideration:- Please note that the embedded resources are included in assembly the way they are added i.e. if you add text file as an embedded resource in the application and open the resultant EXE in notepad, you will see the exact contents of the text file. So when using license file as an embedded resource, anyone can open EXE file in some simple text editor and see/extract the contents of embedded license.

Therefore, in order to put an extra layer of security when embedding the license with the application, you can compress/encrypt license and after that, you can embed it into the assembly. A free utility DotNetZip (http://dotnetzip.codeplex.com/) can help to fulfil this requirement. Suppose we have Aspose.Barcode.lic license file, so let’s make Aspose.Barcode.lic.zip with password test and embed this zip file into solution. The following code snippet can be used to initialize the license:

using (Stream zip = new SecureLicense().GetType().Assembly.GetManifestResourceStream("Aspose.Barcode.lic.zip"))
{
    using (ZipFile zf = ZipFile.Read(zip))
    {
        MemoryStream ms = new MemoryStream();
        ZipEntry e = zf["Aspose.Barcode.lic"];
        e.ExtractWithPassword(ms, "test");
        ms.Position = 0;
    }
}

Appreciate it!

@treecej,

You are welcome.