This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

WaterObjects.NET: Change in Haestad.LicensingFacade at 10.02.00.43?


This doesn't seem to work at 10.02.00.43. Guidance please?

//WriteLine("Acquiring license...");
ProductRelease aproduct = new ProductRelease(ProductId.Bentley_WaterGEMS, "10.02.00.43"); //10.01.00.72
Haestad.LicensingFacade.License alicense = Haestad.LicensingFacade.License.Default(aproduct);

alicense.StartDesktop(false);


Thanks,

Bob Henry

Parents
  • Hi Bob,

    Due to some changes to support CONNECT Licensing, the API for the License object has changed.

    Use the following code to setup licensing using CONNECT licensing:

    using Haestad.LicensingFacade;  // Add a using statement at the top of your class file.
    
    // Create the ProductRelease object
    ProductRelease aproduct = new ProductRelease(ProductId.Bentley_WaterGEMS, "10.02.00.43");
    
    // Get the license object for the product.
    License license = License.Default(aproduct, IntPtr.Zero, null);
    
    // Start the license
    license.StartDesktop();
    
    // Initialize internals of the license.
    license.Initialize();
    
    // Note:  the second parameter of Default is the owner window handle.  If you have access to
    // a System.Windows.Forms.Form object, I would recommend passing in Form.Handle where Form
    // represents a System.Windows.Forms.Form.  Handle is a property on the Form object which is
    // an IntPtr.  This will allow any messages from the license API to be displayed.

    If you have any questions, please do not hesitate to ask.

    Kris Culin

    Senior Software Engineer, Water Infrastructure

    Bentley Systems, Inc.

    Answer Verified By: Robert Henry 

  • I'm revising this application and I'm now unable to debug.  When I run the application I get the following error:

    An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
    The specified module could not be found. (Exception from HRESULT: 0x8007007E)

    I built my app off the SDK WaterObjects.NET.PressureEngineRunner example so I went back to the sample code and modified the license connection as suggested above and still get the same error.  I also created a new application with code just to Initialize the licence and still get the same error.

    I have a note to add some DLL files:

    Required Output Files

     Assure that both the …\Output\...\bin\x64 Debug and Release folders contain the following DLL files: 

    • Bentley.liclib.10.dll
    • Bentley.liclib.dll
    • DLL

     These files are not copied when building the project.

    I copied the 10.02.00.43 version of the files but noticed that Bentley.liclib.10.dll is no longer in the C:\Program Files (x86)\Bentley\WaterGEMS\x64 folder.  

    Thanks,

    Bob Henry

  • Hi Robert,

    You need to manually copy bentley.entliclib.dll from the WaterGEMS installation folder (root is x86 the x64 folder is an x64-specific copy)..

    These DLLs are not automatically copied because they are C DLLs and cannot be directly referenced from a .NET project.

    The Bentley.License.Library.10.NET.dll file is for the prior version of our licensing SDK.

    I hope that helps.

    Kris Culin

    Senior Software Engineer, Water Infrastructure

    Bentley Systems, Inc.

  • Hello Robert, what version of WaterGEMS are you using?

    Did you follow the advice at the bottom of this article to update your code to use the new Subscription Entitlement Service (formerly known as CONNECT Licensing, which was introduced starting with 10.02.00.43)

    Can you provide a copy of your source code? 


    Regards,

    Jesse Dringoli
    Technical Support Manager, OpenFlows
    Bentley Communities Site Administrator
    Bentley Systems, Inc.

  • Please note that I have updated the related wiki article with information about the bentley.entliclib.dll file.


    Regards,

    Jesse Dringoli
    Technical Support Manager, OpenFlows
    Bentley Communities Site Administrator
    Bentley Systems, Inc.

  • Unfortunately, that did not work.  Same error.

    I have there 3 files in my debug folder before I build:

    12/18/2018 06:43 PM 1,184,168 bentley.entliclib.dll
    12/18/2018 06:43 PM 1,651,704 Bentley.liclib.dll
    12/18/2018 06:43 PM 625,664 C4DLL.DLL

    I setup a bare bones app with just the code in your original answer.  It never gets past:

    ProductRelease aproduct = new ProductRelease(ProductId.Bentley_WaterGEMS, "10.02.00.43");

  • Hi Robert,

    My sincerest apologies for the confusion.

    I think I've got it figured out for you.

    Your project needs to reference Haestad.LicensingFacade.dll and Haestad.Support.dll.  If you are building x64, make sure you reference Haestad.LicensingFacade.dll from the x64 folder of your WaterGEMS installation (the root of the installation is x86).

    Copy the appropriate version of bentley.entliclib.dll and Haestad.Licensing.dll into your output folder.

    Instead of manually copying the files, you can use the post build event:

    xcopy "C:\Program Files (x86)\Bentley\WaterGEMS\x64\bentley.entliclib.dll" $(TargetDir) /q /y /r /d
    xcopy "C:\Program Files (x86)\Bentley\WaterGEMS\x64\Haestad.Licensing.dll" $(TargetDir) /q /y /r /d

    The above two lines will automatically copy the two files into your output folder.  This also assumes you are building x64.  If you are building for x86, remove the x64 portion of the folder path.

    There was also an error in my original code snippet (two of the calls were out of order).  The correct code is as follows:

    // Create the ProductRelease object
    ProductRelease aproduct = new ProductRelease(ProductId.Bentley_WaterGEMS, "10.02.00.43");
    
    // Get the license object for the product.
    License license = License.Default(aproduct, IntPtr.Zero, null);
    
    // Initialize internals of the license.
    license.Initialize();
    
    // Start the license
    license.StartDesktop();
    
    license.StopDesktop();
    license.Dispose();
    license = null;

    This should all work as I also setup a very simple project to make sure my information is accurate.

    If you have any additional questions or problems please do not hesitate to ask.

    Kind Regards,

    Kris Culin

    Senior Software Developer, Water Infrastructure

    Bentley Software

    Answer Verified By: Robert Henry 

Reply
  • Hi Robert,

    My sincerest apologies for the confusion.

    I think I've got it figured out for you.

    Your project needs to reference Haestad.LicensingFacade.dll and Haestad.Support.dll.  If you are building x64, make sure you reference Haestad.LicensingFacade.dll from the x64 folder of your WaterGEMS installation (the root of the installation is x86).

    Copy the appropriate version of bentley.entliclib.dll and Haestad.Licensing.dll into your output folder.

    Instead of manually copying the files, you can use the post build event:

    xcopy "C:\Program Files (x86)\Bentley\WaterGEMS\x64\bentley.entliclib.dll" $(TargetDir) /q /y /r /d
    xcopy "C:\Program Files (x86)\Bentley\WaterGEMS\x64\Haestad.Licensing.dll" $(TargetDir) /q /y /r /d

    The above two lines will automatically copy the two files into your output folder.  This also assumes you are building x64.  If you are building for x86, remove the x64 portion of the folder path.

    There was also an error in my original code snippet (two of the calls were out of order).  The correct code is as follows:

    // Create the ProductRelease object
    ProductRelease aproduct = new ProductRelease(ProductId.Bentley_WaterGEMS, "10.02.00.43");
    
    // Get the license object for the product.
    License license = License.Default(aproduct, IntPtr.Zero, null);
    
    // Initialize internals of the license.
    license.Initialize();
    
    // Start the license
    license.StartDesktop();
    
    license.StopDesktop();
    license.Dispose();
    license = null;

    This should all work as I also setup a very simple project to make sure my information is accurate.

    If you have any additional questions or problems please do not hesitate to ask.

    Kind Regards,

    Kris Culin

    Senior Software Developer, Water Infrastructure

    Bentley Software

    Answer Verified By: Robert Henry 

Children
No Data