How to create a license key file

acjagacjagacjagacjag Posts: 9
How to create a license key file/redistributable package for the Redgate API dlls. Suppose I want to run the application (which uses the Redgate API dlls) in another machine requires the RedGate installation in the target machine.
Can we create any license key file for API dlls? Please let me know the documents regarding the same if available.

Thanks in Advance.

Comments

  • If you compile an application against the Comparison SDK with a licenses.licx file (as per the samples http://www.red-gate.com/sqltoolkit/latestsamples/sql_data_compare_API ) the application should be able to run on any machine without requiring a license.

    If you have problems this article ( http://www.red-gate.com/supportcenter/Content.aspx?p=SQL%20Comparison%20SDK&c=knowledgebase%5cSQL_Comparison_SDK%5cKB200710000160.htm ) has more information.[/url]
  • It doesn't works. I added licenses.licx file and added the following lines in it.
    RedGate.SQLDataCompare.Engine.ComparisonSession, RedGate.SQLDataCompare.Engine
    RedGate.SQLCompare.Engine.Database, RedGate.SQLCompare.Engine

    But this still fails to execute. I am using the API dlls in a web application, which works in the machine where RedGate toolbelt installed. But it doesn't work if RedGate toolbelt not installed in a machine.
    I am using the DataCompare version 7.1.0.230

    Any help welcome.
    Thanks in advance.
  • Is the licenses.licx file set with Build Action "Embedded Resource" and included in the root directory of your project(s)?
    From the knowledge base article I linked above

    "Don't copy the licenses.licx file from another folder manually, for instance using a command prompt or Windows Explorer. It should be added as a new item at the Visual Studio project level with a build action of "Embedded Resource"

    In order to check that the licx file is correctly included you can use reflector

    "If a licence file produced as the result of a successful activation is present on the build computer, the build will silently succeed. To double-check that your assembly has been licensed successfully,
    you may use a tool such as .NET Reflector (http://reflector.red-gate.com/download.aspx), open your assembly, expand 'resources', locate a resource called <YourAssemblyFileName>.licenses, view the resource, and make sure that the resource contains 'RedGate.SQLCompare.Engine.Database' and also 'RedGate.SQLDataCompare.Engine.ComparisonSession' if you had also referenced the Data Compare Engine in your project."
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi,

    Since web applications are compiled dynamically, this creates a problem when trying to licence assemblies. We usually recommend simply separating the SQL SDK functions into their own dll so that you can licence it the "normal way" as described above, but I think you can actually create a satellite dll and refernece it from your web app code. I'm testing that theory out as we speak. I'll post a reply if my theory works out.
  • I tried the way said at "6. Web and SQL ToolKit" in
    http://www.red-gate.com/supportcenter/C ... 000160.htm

    As it says “The recommended workaround for licensed customers is to move all SQL Comparison API functions into a stand-alone class library project, then reference that dll from your web application.”

    I created a dll which will have all the functionalities.. and I referencing the dlls (and necessary API dlls) and calling the method. But it still throws error.

    Let me know if any one found the way…
    Thanks in Advance...
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    I don't know why you can't licence the dll, but here is how you can licence the entire web application dynamically. First, follow the instructions in our knowledge base for manually creating a licence resource (the names are changed slightly):
    - Launch a Visual Studio command prompt from the Tools menu of the Visual Studio program group
    - Change directory to your project folder where your project's source code is located
    - Create a new text document for the licence information:

    notepad licence.txt

    Enter these contents into licence.txt:

    RedGate.SQLCompare.Engine.Database, RedGate.SQLCompare.Engine<return>

    (Note that if you were also referencing Data Compare's engine, you would mention it on the next line:
    RedGate.SQLDataCompare.Engine.ComaprisonSession, RedGate.SQLDataCompare.Engine)

    Save the file and exit.

    Run the licence compiler:

    lc.exe /target:"WebApplication1.Licenses.Resources.dll" /complist:"licence.txt" /i:"c:\program files\red gate\sql compare 7\RedGate.SQLCompare.Engine.dll" (optionally /i:"c:\program files\red gate\sql data compare 7\RedGate.SQLDataCompare.Engine.dll")
    Now you have a compiled resource file called WebApplication1.Licenses.Resources.dll.licenses. Compile the resource into a satellite assembly using the assembly linker:
    al /t:lib /embed:WebApplication1.Licenses.Resources.dll.licenses /culture:neutral /out:WebApplication1.Licenses.Resources.dll
    
    Copy this dll into the Bin folder of the web application. This should dynamically link the licenses in automatically every time ASP .NET decides to compile the web application.

    I hope that this works for you.
  • - Have you checked that the resource is in the assembly
    - Are you in your trial period for the SDK. (Do you get nag dialogs appearing when running the application locally)
    - What is the error which is thrown on failure
  • acjagacjag wrote:
    I tried the way said at "6. Web and SQL ToolKit" in
    http://www.red-gate.com/supportcenter/C ... 000160.htm

    As it says “The recommended workaround for licensed customers is to move all SQL Comparison API functions into a stand-alone class library project, then reference that dll from your web application.”

    I created a dll which will have all the functionalities.. and I referencing the dlls (and necessary API dlls) and calling the method. But it still throws error.

    Let me know if any one found the way…
    Thanks in Advance...

    This will work. The bin folder will contain [standalone dll].licenses which is important.

    Thanks and apologize for the delay.
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi,
    I think that you have a choice -- you can either licence the whole web application by creating the satellite dll, or presumably create the .licenses file and have ASP .NET dynamically compile it in (I haven't tried that one).

    The other option is to create a dll containing only the functions from the Comparison SDK, and let Visual Studio embed the licence resource into the dll according to the instructions in the help file.

    If you go about the second way, you can verify that the licensing was successful by opening the assembly with .NET Reflector and looking for a resource called YourAssembly.dll.resources. This must also match the assembly name in a case-sensitive fashion.
  • I have successfully created the licence.licx file but...

    My serial number is stored as hex in the compiled code, is there any way to mask or obfuscate it?
    .:Steve:.
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    As far as I know, the serial number has to be in the licence resource in order for the licensing to work.

    Using an obfuscator like SmartAssembly may work, as it encrypts resources.
Sign In or Register to comment.