Using SQL Toolkit with Delphi 2006

pwoonpwoon Posts: 18
edited April 17, 2006 9:51AM in SQL Toolkit Previous Versions
Hello,
We have old serial numbers from 2004, and I'm hoping they work for SQL Toolkit 5, since I just joined this company and nobody can find the software for the version we had. However, barring the serial number issue. I get the following when trying to compile the app in Delphi 2006 :

[LC Error] licenses.licx(1): LC0004 : Exception occured creating type 'System.Security.SecurityException'
[Pascal Error] E2199 Packages 'RedGate.Licensing.Client' and 'RedGate.Licensing.Helper' both contain unit '.RedGate.Licensing.Helper'
[Pascal Fatal Error] F2220 Could not compile package 'RedGate.Licensing.Client'

What am I doing wrong? and how do I see if our serial numbers will work?

Comments

  • Ok, I've got it to get rid of the Namespace issues but I still get :

    [LC Error] licenses.licx(1): LC0004 : Exception occured creating type 'System.Security.SecurityException'
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    What is contained in your licenses.licx file? With Framework 2.0, you also need to include the assembly name. There are some posts about this in the Toolkit v4 forum.

    Also, I have seen this happen before when .NET assemblies try to run across the network (from a share, for example).
  • Hi Brian,
    I've got

    RedGate.SQLCompare.Engine.Database, RedGate.SQLCompare.Engine in the licx file. Also, the other error with the namespace issue is back. I get

    [LC Error] licenses.licx(1): LC0004 : Exception occured creating type 'System.Security.SecurityException'
    [Pascal Error] E2199 Packages 'RedGate.Licensing.Client' and 'RedGate.Licensing.Helper' both contain unit '.RedGate.Licensing.Helper'


    I'm not trying to compile across the network or implemented any assembly trusts.

    Also, I've noticed that when I do a build all, I get the above error messages one time, then when I build again, I get:

    [LC Error] licenses.licx(1): LC0004 : Exception occured creating type 'System.Security.SecurityException'
    [Pascal Fatal Error] SchemaCmpMain.pas(20): F1026 File not found: 'RedGate.SQLCompare.Engine.dcuil'

    Next time I build, I get the first error messages and so on.
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello Phillip,

    Delphi+Pascal is a whole new ball-game. It should work, though. Can you check that there are no 'blank lines' in the licenses.licx file (there is a bug in Visual Studio -- possibly this affects lc.exe on its' own as well). Also, that licenses.lics is added to the project as an 'embedded resource' in the file properties.
  • Hi Brian,
    I got past the other namespace errors (don't know why I get those sometimes). What should be in the licenses.licx file? Also, will the .LIC file be created automatically when I provide the serial numbers if prompted?

    Thanks
    Phillip
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello Phillip,

    It works like this: you create a licenses.licx, with the names of the licensed components, as an embedded resource in your project. When the .NET compiler runs, it should know to call lc.exe. Our component knows that the licensing is a custom job, and loads RedGate.Licensing.Client/Helper. These are the components that show the 'enter serial number' box and do the activation. When the activation is successful, you get a 'SQL Toolkit.lic' file on your hard disk. The information in the .lic is embedded into your assembly's resource fork by lc.exe.

    The sample format for licenses.licx is in the Toolkit help file. There should be a line for each licensed object/assembly, eg:

    RedGate.SQLCompare.Engine.Database,RedGate.SQLCompare.Engine
  • Hi Brian,
    I got it to work. We have two programs and one of the licx files work. For some reason the other didn't. However, when does it prompt to input a serial number? I thought it would prompt when I run the exe outside of the IDE.

    Thanks
    Phillip
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    It may or may not ask for a serial number. Remember: The licence is embedded into your assembly at compile time and therefore the compiled application should never ask for a serial number or nag at you about purchasing the product.

    If the licensing system finds a 'SQL Toolkit.lic' file on the hard disk, it will not ask for the serial number. The licensing will detect the licence file and embed that information into the assembly when you build it. You may already have a 'SQL Toolkit.lic' file, either in the references path or in the project's BIN folder. In that case, you won't be asked for the serial number again.
  • Hi Brian,
    Does it have something to do with the Exe.Licenses file?

    Thanks
    Phillip
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Phillip,

    If I recall correctly, LC.exe creates this .licenses file when you implement product licensing without a custom licence handler. We haven't done this, though, we have implemented our own custom licensing component: this is the bit of code that asks for your serial number and does the Internet/email activation. If you have a .licenses file being created, it would be because lc.exe did not call RedGate.Licensing.Client.dll like it's supposed to!
  • Actually,
    It doesn't generate the Licenses file. A colleague of mine was working with it before he went to China on vacation. He had the licenses file. If the licenses file is not in my folder, the compilation fails. If it's there, it compiles just fine.

    On another subject, what is the syntax for setting the options in the compare. Do I simply OR all the options together in the CompareWith method?
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Wierd. This must be some behaviour specific to Delphi. I do know that if you do not have custom licensing, your end-product is a .licenses file. LC.exe is notoriously flaky, I'll admit.

    To specify more than one option in any enumeration, the procedure is to BITWISE OR them together. So if you're using c#, don't be tempted to logically Or using a double-bar, but bitwise or using a single bar (|).

    In VB, this doesn't make any difference because supposedly it determines which kind of Or to use for you. You can just say 'Or'.

    I'm not sure about Delphi (is it Pascal?).
  • In Delphi it would be the same as VB ; an OR is the same logical or bitwise

    Yes, Delphi is Object pascal
Sign In or Register to comment.