Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

LicensingManagement RegisterManagedResource: EasyDAClient vs EasyUAClient

More
08 Feb 2021 19:20 #9424 by support
That's right.

No problem, I am glad it works!

Best regards

Please Log in or Create an account to join the conversation.

More
08 Feb 2021 19:14 #9423 by mpp
Uh ok, got it. I shouldn't test for the license before loading it!

I commented the first IsDemo check and it now works as expected.
Thanks for the help and patience!

Have a great day,

Please Log in or Create an account to join the conversation.

More
08 Feb 2021 19:08 #9422 by support
OK, no need for the solution.

The license needs to be registered before the first use of the component. That's not the case in your code. You first instantiate the EasyDAClient and look at its license, and only then you register the license. Doing so will fix it to the license it had at the time you displayed the license, that is, the trial license. The license cannot be swapped afterwards.

Best regards

Please Log in or Create an account to join the conversation.

More
08 Feb 2021 18:54 #9421 by mpp
Yes, I can share a sample visual studio solution if you tell me that is safe to put the license in it.

Otherwise it is very simple.
I uninstalled all the version of EasyOPC I had on my pc (not necessary) and also uninstalled all the license I previously installed with the license manager application.
(see attached screenshot)

The code is simple with just one class:
using OpcLabs.BaseLib.ComponentModel;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.UA;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
 
namespace ConsoleApp
{
    class Program
    {
        public static void LoadLicense()
        {
            // Register a license that is we embed as a managed resource in this program.
 
            // The first two arguments should always be "QuickOPC" and "Multipurpose".
            // The third argument determines the assembly where the license resides.
            // The fourth argument is the namespace-qualified name of the managed resource.
            LicensingManagement.Instance.RegisterManagedResource("QuickOPC", "Multipurpose",
                Assembly.GetExecutingAssembly(),
                "ConsoleApp.Key-Permanent-ShareIt-1999420671-20210120.bin");
 
            // Instantiate the client object, obtain the serial number from the license info, and display the serial number.
            var client = new EasyDAClient();
            long serialNumber = (uint)client.LicenseInfo["Multipurpose.SerialNumber"];
            Console.WriteLine("SerialNumber: {0}", serialNumber);
 
            // Instantiate the client object, obtain the serial number from the license info, and display the serial number.
            var clientUA = new EasyUAClient();
            serialNumber = (uint)clientUA.LicenseInfo["Multipurpose.SerialNumber"];
            Console.WriteLine("SerialNumber: {0}", serialNumber);
        }
 
        public static bool IsDemo()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();
 
            // Obtain the serial number from the license info.
            long serialNumber = (uint)client.LicenseInfo["Multipurpose.SerialNumber"];
 
            // Display the serial number.
            Console.WriteLine("SerialNumber: {0}", serialNumber);
 
            // Determine whether we are running as demo or trial.
            if ((1111110000 <= serialNumber) && (serialNumber <= 1111119999))
                return true;
            else
                return false;
        }
 
        static void Main(string[] args)
        {
            Console.WriteLine(IsDemo());
 
            LoadLicense();
 
            Console.WriteLine(IsDemo());
        }
    }
}

The output is in the attached screenshot, you can see that the EasyDAClient is not getting the license.
Attachments:

Please Log in or Create an account to join the conversation.

More
08 Feb 2021 18:25 #9419 by support
Hello.

EasyDAClient should support this method as well. I tried your example and I cannot reproduce it. I get both serial numbers correctly. Any way you can help me to reproduce it?

App_Web_OpcLabs.EasyOpcClassicRaw.x86.dll: This is a known issue, but unfortunately no full solution. It is NuGet bug (referencing the assembly is not actually necessary, but it should be copied to the output directory, which NuGet is not doing; referencing it is a workaround that forces it to be copied, ).

Best regards

Please Log in or Create an account to join the conversation.

More
08 Feb 2021 17:47 #9418 by mpp
The DLL project that is referencing the nuget package is targeting .net framework.
Same for the Unit Test project that is referencing the DLL project.
    <TargetFramework>net471</TargetFramework>
    <Platforms>x86</Platforms>

PS: second question unrelated question, is there a way to automatically make the nuget package to include the dll App_Web_OpcLabs.EasyOpcClassicRaw.x86.dll?
I thought it was automatic but I find myself having to do it manually or with a post compilation script. Otherwise I get a runtime error as it cannot find it.

Please Log in or Create an account to join the conversation.

More
08 Feb 2021 17:42 #9417 by support
Thank you.

I am sorry - one more question - is your project targeting .NET Core, or .NET Framework?

Regards

Please Log in or Create an account to join the conversation.

More
08 Feb 2021 17:40 #9416 by mpp
The license is for the 2020.3.
I'm using the most recent nuget package 5.59.1055

Please Log in or Create an account to join the conversation.

More
08 Feb 2021 17:38 #9415 by support
Hello,
which QuickOPC version are you using please?

Kind regards

Please Log in or Create an account to join the conversation.

More
08 Feb 2021 17:33 #9414 by mpp
Hi, is LicensingManagement.Instance.RegisterManagedResource supported by the EasyDAClients?
            LicensingManagement.Instance.RegisterManagedResource("QuickOPC", "Multipurpose",
                Assembly.GetExecutingAssembly(),
                "xxx.Key-Permanent-ShareIt-xxx-xxx.bin");
 
            // Instantiate the client object, obtain the serial number from the license info, and display the serial number.
            var client = new EasyDAClient();
            long serialNumber = (uint)client.LicenseInfo["Multipurpose.SerialNumber"];
            Console.WriteLine("SerialNumber: {0}", serialNumber);
 
            // Instantiate the client object, obtain the serial number from the license info, and display the serial number.
            var clientUA = new EasyUAClient();
            serialNumber = (uint)clientUA.LicenseInfo["Multipurpose.SerialNumber"];
            Console.WriteLine("SerialNumber: {0}", serialNumber);

The EasyDAClient prints 1111111120 which is demo
The EasyUAClient print the correct license number

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.058 seconds