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

  • 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 

  • Thanks, I had the IntPtr.Zero but the message handler was messing me up!

  • This information has been documented into a wiki format, which shall be useful for other users facing similar issue. 

    Haestad.LicensingFacade.License alicense – WaterObjects.NET Error when using with Update 2 versions - Connect Licensing 

    Regards,

    Sushma Choure

    Bentley Technical Suppport

  • 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.